diff --git a/tests/app/dao/test_fact_notification_status_dao.py b/tests/app/dao/test_fact_notification_status_dao.py index ab347eb124..8f649e174a 100644 --- a/tests/app/dao/test_fact_notification_status_dao.py +++ b/tests/app/dao/test_fact_notification_status_dao.py @@ -259,9 +259,9 @@ def test_fetch_notification_status_for_service_for_today_and_7_previous_days( create_ft_notification_status(date(2018, 10, 29), "email", service_1, count=3) # 3 SMS / 1 email - save_notification(create_notification(sms_template, created_at=datetime(2018, 10, 31, 11, 0, 0))) + save_notification(create_notification(sms_template, created_at=datetime(2018, 10, 31, 11, 0, 0))) save_notification(create_notification(sms_template_2, created_at=datetime(2018, 10, 31, 11, 0, 0))) - save_notification(create_notification(sms_template, created_at=datetime(2018, 10, 31, 12, 0, 0), status="delivered")) + save_notification(create_notification(sms_template, created_at=datetime(2018, 10, 31, 12, 0, 0), status="delivered")) save_notification(create_notification(email_template, created_at=datetime(2018, 10, 31, 13, 0, 0), status="delivered")) # too early, shouldn't be included @@ -378,13 +378,13 @@ def test_timing_for_facts(self, notify_db_session): @freeze_time("2024-09-25 12:25:00") def test_fetch_notification_status_for_service_for_today_and_7_previous_days_doesnt_include_extra_days(self, sample_template): """ - This test ensures that `fetch_notification_status_for_service_for_today_and_7_previous_days()` only counts facts and notifications for the days - in the range of 2024-09-18 to 2024-09-25 (the last 7 days, starting at the 25th). It creates notifications at 00:00:00 and 23:59:59 to make sure - no notifications at the boundaries are included by mistake. + This test ensures that `fetch_notification_status_for_service_for_today_and_7_previous_days()` only counts facts and notifications for the days + in the range of 2024-09-18 to 2024-09-25 (the last 7 days, starting at the 25th). It creates notifications at 00:00:00 and 23:59:59 to make sure + no notifications at the boundaries are included by mistake. - It creates facts for the last 10 days, but only the last 6 days should be counted. + It creates facts for the last 10 days, but only the last 6 days should be counted. - It creates notifications for the current day and the day before, but only the current day should be counted. + It creates notifications for the current day and the day before, but only the current day should be counted. """ service_1 = create_service(service_name="service_1") email_template = create_template(service=service_1, template_type=EMAIL_TYPE) @@ -412,14 +412,16 @@ def test_fetch_notification_status_for_service_for_today_and_7_previous_days_doe assert sum([x.count for x in results]) == 16 @freeze_time("2024-09-25 12:25:00") - def test_fetch_notification_status_for_service_for_today_and_7_previous_days_gets_extra_days_from_notifications(self, sample_template): + def test_fetch_notification_status_for_service_for_today_and_7_previous_days_gets_extra_days_from_notifications( + self, sample_template + ): """ - This test ensures that `fetch_notification_status_for_service_for_today_and_7_previous_days()` is able to get notifications from the - notifications table for more than one day when there are no facts for those days. + This test ensures that `fetch_notification_status_for_service_for_today_and_7_previous_days()` is able to get notifications from the + notifications table for more than one day when there are no facts for those days. - It creates facts for the last 5 days, all which should be counted. + It creates facts for the last 5 days, all which should be counted. - It creates 10 notifications for today and 10 for yesterday, all which should be counted. + It creates 10 notifications for today and 10 for yesterday, all which should be counted. """ service_1 = create_service(service_name="service_1") email_template = create_template(service=service_1, template_type=EMAIL_TYPE) @@ -446,6 +448,7 @@ def test_fetch_notification_status_for_service_for_today_and_7_previous_days_get # there should be 5 notifications from the facts table and 20 from notifications assert sum([x.count for x in results]) == 25 + @freeze_time("2018-10-31T18:00:00") def test_fetch_notification_status_gets_data_from_correct_timeframe( notify_db_session,