def test_date_string_comparator_fail_outside_dates(self): library = APILibrary() unmatched = [] library.date_string_comparator("2018-08-08T05:05:05", "2018-08-09T05:05:05", "key", unmatched) assert unmatched == [ ('------------------\nDates Not Close Enough\nKey: key', 'Expected: 2018-08-08 05:05:05', 'Actual: 2018-08-09 05:05:05') ]
def test_date_string_comparator_fail_all_formats(self): library = APILibrary() unmatched = [] library.date_string_comparator("a", "b", "key", unmatched) assert unmatched == [('------------------\nKey: key', 'Expected Date Not Correct Format:', 'Expected Formats: %Y-%m-%dT%H:%M:%S', ' %Y-%m-%dT%H:%M:%SZ', ' %Y-%m-%dT%H:%M:%S.%f', ' %Y-%m-%dT%H:%M:%S.%fZ', 'Date: a'), ('------------------\nKey: key', 'Actual Date Not Correct Format:', 'Expected Formats: %Y-%m-%dT%H:%M:%S', ' %Y-%m-%dT%H:%M:%SZ', ' %Y-%m-%dT%H:%M:%S.%f', ' %Y-%m-%dT%H:%M:%S.%fZ', 'Date: b')]
def test_date_string_comparator_dates_close_enough(self): library = APILibrary() unmatched = [] library.date_string_comparator("2018-08-08T05:05:05", "2018-08-08T05:06:05", "key", unmatched) assert unmatched == []
def test_date_string_comparator_simple(self): library = APILibrary() library.date_string_comparator("a", "a", None, None)