Пример #1
0
    def test_record_to_incident_american_time(self):
        """
        Given:
            record with american time (month first)

        When:
            fetching incidents

        Then:
            assert return dates are right

        """
        client = Client(BASE_URL, '', '', '', '')
        incident = INCIDENT_RECORD.copy()
        incident['record']['Date/Time Reported'] = '03/26/2018 10:03 AM'
        incident['raw']['Field'][1][
            '@xmlConvertedValue'] = '2018-03-26T10:03:00Z'
        incident, incident_created_time = client.record_to_incident(
            INCIDENT_RECORD, 75, '305')
        assert incident_created_time == datetime(2018,
                                                 3,
                                                 26,
                                                 10,
                                                 3,
                                                 tzinfo=timezone.utc)
        assert incident['occurred'] == '2018-03-26T10:03:00Z'
Пример #2
0
def test_record_to_incident():
    client = Client(BASE_URL, '', '', '', '')
    incident, incident_created_time = client.record_to_incident(
        INCIDENT_RECORD, 75, 'Date/Time Reported')
    assert incident_created_time.strftime(
        '%Y-%m-%dT%H:%M:%SZ') == '2018-03-26T10:03:32Z'
    assert incident['name'] == 'RSA Archer Incident: 227602'
    assert incident['occurred'] == '2018-03-26T10:03:32Z'
Пример #3
0
 def test_record_to_incident(self):
     client = Client(BASE_URL, '', '', '', '')
     record = copy.deepcopy(INCIDENT_RECORD)
     record['raw']['Field'][1]['@xmlConvertedValue'] = '2018-03-26T10:03:00Z'
     incident, incident_created_time = client.record_to_incident(record, 75, '305')
     assert incident_created_time == datetime(2018, 3, 26, 10, 3, tzinfo=timezone.utc)
     assert incident['name'] == 'RSA Archer Incident: 227602'
     assert incident['occurred'] == '2018-03-26T10:03:00Z'
Пример #4
0
    def test_record_to_incident_american_time(self):
        """
        Given:
            record with american time (month first)

        When:
            fetching incidents

        Then:
            assert return dates are right

        """
        client = Client(BASE_URL, '', '', '', '')
        incident = INCIDENT_RECORD.copy()
        incident['record']['Date/Time Reported'] = '03/26/2018 10:03 AM'
        incident, incident_created_time = client.record_to_incident(
            INCIDENT_RECORD, 75, 'Date/Time Reported', day_first=False)
        assert incident_created_time.strftime(
            '%Y-%m-%dT%H:%M:%SZ') == '2018-03-26T10:03:00Z'
        assert incident['occurred'] == '2018-03-26T10:03:00Z'