def test_timestamp_to_date_converter_seconds(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 timestamp_to_date
    seconds_since_epoch = "1572164838"
    assert str(timestamp_to_date(seconds_since_epoch)) == "2019-10-27 08:27:18"
Esempio n. 2
0
def test_timestamp_to_date_converter_milliseconds():
    from Elasticsearch_v2 import timestamp_to_date
    milliseconds_since_epoch = "1572164838123"
    assert str(timestamp_to_date(
        milliseconds_since_epoch)) == "2019-10-27 08:27:18.123000"