def test_date_observed_in_range_str_gives_correct_json_representation(): test_before_time = time() test_after_time = time() + 30 # make sure timestamps are actually different formatted_before = format_timestamp(test_before_time) formatted_after = format_timestamp(test_after_time) _filter = DateObserved.in_range(test_before_time, test_after_time) expected = IN_RANGE.format("createdAt", formatted_before, formatted_after) assert str(_filter) == expected
def test_date_observed_on_same_day_str_gives_correct_json_representation(): test_time = time() test_date = datetime.utcfromtimestamp(test_time) start_time = datetime(test_date.year, test_date.month, test_date.day, 0, 0, 0) end_time = datetime(test_date.year, test_date.month, test_date.day, 23, 59, 59) formatted_before = format_datetime(start_time) formatted_after = format_datetime(end_time) _filter = DateObserved.on_same_day(test_time) expected = IN_RANGE.format("createdAt", formatted_before, formatted_after) assert str(_filter) == expected