コード例 #1
0
def test_incident_creation_with_timestamp_e7():
    from Elasticsearch_v2 import results_to_incidents_timestamp
    lastfetch = int(
        datetime.strptime('2019-08-27T17:59:00Z',
                          '%Y-%m-%dT%H:%M:%SZ').timestamp())
    incidents, last_fetch2 = results_to_incidents_timestamp(
        ES_V7_RESPONSE_WITH_TIMESTAMP, lastfetch)
    assert last_fetch2 == 1572502640
    assert str(incidents) == MOCK_ES7_INCIDENTS_FROM_TIMESTAMP
コード例 #2
0
def test_incident_creation_with_timestamp_e7(params, mocker):
    mocker.patch.object(demisto, 'params', return_value=params)
    importlib.reload(
        Elasticsearch_v2
    )  # To reset the Elasticsearch client with the OpenSearch library
    mocker.patch('Elasticsearch_v2.TIME_METHOD', 'Timestamp-Seconds')
    from Elasticsearch_v2 import results_to_incidents_timestamp
    lastfetch = int(
        datetime.strptime('2019-08-27T17:59:00Z',
                          '%Y-%m-%dT%H:%M:%SZ').timestamp())
    incidents, last_fetch2 = results_to_incidents_timestamp(
        ES_V7_RESPONSE_WITH_TIMESTAMP, lastfetch)
    assert last_fetch2 == 1572502640
    assert str(incidents) == MOCK_ES7_INCIDENTS_FROM_TIMESTAMP