add transactional wrapper

and add case to get_notification_table_to_use test
This commit is contained in:
Leo Hemsted
2019-12-04 15:26:26 +00:00
parent dd57468147
commit 8d160303a1
3 changed files with 7 additions and 4 deletions

View File

@@ -85,6 +85,7 @@ def test_get_notification_table_to_use_respects_daylight_savings_time(sample_ser
@freeze_time('2019-01-10 00:30')
def test_get_notification_table_to_use_checks_service_data_retention(sample_service):
create_service_data_retention(sample_service, 'email', days_of_retention=3)
create_service_data_retention(sample_service, 'letter', days_of_retention=9)
# it's currently early morning of Thurs 10th Jan.
# three days retention means we'll delete sunday 6th's data when the delete task runs (so there's still three full
@@ -92,6 +93,9 @@ def test_get_notification_table_to_use_checks_service_data_retention(sample_serv
assert get_notification_table_to_use(sample_service, 'email', date(2019, 1, 5), False) == NotificationHistory
assert get_notification_table_to_use(sample_service, 'email', date(2019, 1, 6), False) == Notification
assert get_notification_table_to_use(sample_service, 'letter', date(2018, 12, 30), False) == NotificationHistory
assert get_notification_table_to_use(sample_service, 'letter', date(2018, 12, 31), False) == Notification
# falls back to 7 days if not specified
assert get_notification_table_to_use(sample_service, 'sms', date(2019, 1, 1), False) == NotificationHistory
assert get_notification_table_to_use(sample_service, 'sms', date(2019, 1, 2), False) == Notification