Refactor process_ses_receipt

It is possible a service has data rention that is smaller than the time it takes to get a delivery receipt.
This PR refactors process_ses_receipt to update NotificationHistory if the Notifcation has already been purged.
This commit is contained in:
Rebecca Law
2020-03-27 14:12:39 +00:00
parent 8da73510c2
commit 46b72a6bbb
4 changed files with 28 additions and 24 deletions

View File

@@ -1567,7 +1567,9 @@ def test_dao_update_notifications_by_reference_set_returned_letter_status(sample
assert updated_count == 1
assert updated_history_count == 0
assert Notification.query.get(notification.id).status == 'returned-letter'
updated_notification = Notification.query.get(notification.id)
assert updated_notification.status == 'returned-letter'
assert updated_notification.updated_at <= datetime.utcnow()
def test_dao_update_notifications_by_reference_updates_history_when_one_of_two_notifications_exists(