def test_can_delete_index(index, cutoff_date, expected_result): es = ElasticsearchLogs(index_prefix=INDEX_NAME_PREFIX) assert datetime.strptime(index.split(es._index_prefix, 1)[-1], INDEX_DATE_FORMAT) assert es.can_delete_index(index, cutoff_date) == expected_result
def test_valid_index_prefix(prefix, is_valid): assert ElasticsearchLogs._valid_index_prefix(prefix) == is_valid