mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
process letters for 10 days when updating ft_notification_status
sms and emails have a very predictable 72 hour lifecycle. letters, on the other hand, have ridiculously complex lifecycles - they might not get sent because it's a weekend, they might not get sent because they're second class and are only processed on alternate days, they might not get sent because a different letter in the same batch had an error that we didn't know about. Either way, it's apparent that four days is definitely not enough time to guarantee that letters have gone from sending to delivered. Extend the amount of days we process for letters to 10 days. Keep emails and sms down at 4 to keep run-times shorter We're deliberately not thinking about returned letters here at all.
This commit is contained in:
@@ -54,16 +54,27 @@ def test_create_nightly_notification_status_triggers_tasks_for_days(notify_api,
|
||||
mock_celery = mocker.patch('app.celery.reporting_tasks.create_nightly_notification_status_for_day')
|
||||
create_nightly_notification_status()
|
||||
|
||||
assert mock_celery.apply_async.call_count == 4 * 3 # four days, three notification types
|
||||
assert mock_celery.apply_async.call_count == (
|
||||
(4 * 3) # four days, three notification types
|
||||
+
|
||||
6 # six more days of just letters
|
||||
)
|
||||
|
||||
for process_date, notification_type in itertools.product(
|
||||
['2019-07-31', '2019-07-30', '2019-07-29', '2019-07-28'],
|
||||
['sms', 'email', 'letter']
|
||||
[SMS_TYPE, EMAIL_TYPE, LETTER_TYPE]
|
||||
):
|
||||
mock_celery.apply_async.assert_any_call(
|
||||
kwargs={'process_day': process_date, 'notification_type': notification_type},
|
||||
queue=QueueNames.REPORTING
|
||||
)
|
||||
|
||||
for process_date in ['2019-07-27', '2019-07-26', '2019-07-25', '2019-07-24', '2019-07-23', '2019-07-22']:
|
||||
mock_celery.apply_async.assert_any_call(
|
||||
kwargs={'process_day': process_date, 'notification_type': LETTER_TYPE},
|
||||
queue=QueueNames.REPORTING
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('second_rate, records_num, billable_units, multiplier',
|
||||
[(1.0, 1, 2, [1]),
|
||||
|
||||
Reference in New Issue
Block a user