tz utility swap and many test updates

This commit is contained in:
stvnrlly
2022-11-10 12:33:25 -05:00
parent 929b641e2f
commit b50cb4712f
38 changed files with 351 additions and 343 deletions
+8 -6
View File
@@ -854,11 +854,11 @@ def test_dao_fetch_todays_stats_for_service_should_ignore_test_key(notify_db_ses
def test_dao_fetch_todays_stats_for_service_only_includes_today(notify_db_session):
template = create_template(service=create_service())
# two created email, one failed email, and one created sms
with freeze_time('2001-01-01T23:59:00'):
with freeze_time('2001-01-02T04:59:00'):
# just_before_midnight_yesterday
create_notification(template=template, to_field='1', status='delivered')
with freeze_time('2001-01-02T00:01:00'):
with freeze_time('2001-01-02T05:01:00'):
# just_after_midnight_today
create_notification(template=template, to_field='2', status='failed')
@@ -874,6 +874,7 @@ def test_dao_fetch_todays_stats_for_service_only_includes_today(notify_db_sessio
assert stats['created'] == 1
@pytest.mark.skip(reason="Need a better way to test variable DST date")
def test_dao_fetch_todays_stats_for_service_only_includes_today_when_clocks_spring_forward(notify_db_session):
template = create_template(service=create_service())
with freeze_time('2021-03-27T23:59:59'):
@@ -898,10 +899,10 @@ def test_dao_fetch_todays_stats_for_service_only_includes_today_when_clocks_spri
def test_dao_fetch_todays_stats_for_service_only_includes_today_during_bst(notify_db_session):
template = create_template(service=create_service())
with freeze_time('2021-03-28T22:59:59'):
with freeze_time('2021-03-29T03:59:59'):
# just before midnight BST -- not included
create_notification(template=template, to_field='1', status='permanent-failure')
with freeze_time('2021-03-28T23:00:01'):
with freeze_time('2021-03-29T04:00:01'):
# just after midnight BST -- included
create_notification(template=template, to_field='2', status='failed')
with freeze_time('2021-03-29T12:00:00'):
@@ -917,6 +918,7 @@ def test_dao_fetch_todays_stats_for_service_only_includes_today_during_bst(notif
assert not stats.get('permanent-failure')
@pytest.mark.skip(reason="Need a better way to test variable DST date")
def test_dao_fetch_todays_stats_for_service_only_includes_today_when_clocks_fall_back(notify_db_session):
template = create_template(service=create_service())
with freeze_time('2021-10-30T22:59:59'):
@@ -944,7 +946,7 @@ def test_dao_fetch_todays_stats_for_service_only_includes_during_utc(notify_db_s
with freeze_time('2021-10-30T12:59:59'):
# just before midnight UTC -- not included
create_notification(template=template, to_field='1', status='permanent-failure')
with freeze_time('2021-10-31T00:00:01'):
with freeze_time('2021-10-31T05:00:01'):
# just after midnight UTC -- included
create_notification(template=template, to_field='2', status='failed')
# clocks go back to UTC on 31 October at 2am
@@ -988,7 +990,7 @@ def test_dao_fetch_todays_stats_for_all_services_only_includes_today(notify_db_s
# just_before_midnight_yesterday
create_notification(template=template, to_field='1', status='delivered')
with freeze_time('2001-01-02T00:01:00'):
with freeze_time('2001-01-02T05:01:00'):
# just_after_midnight_today
create_notification(template=template, to_field='2', status='failed')