Add notification status for returned letters

We need to update letter notifications with a new status when DVLA
gives us a list of references for returned letters.

This adds the new status to the models and the DB.

DVLA call this 'returned mail', so I'm using it as the status name
since it seems less ambiguous than 'returned'.
This commit is contained in:
Alexey Bezhan
2018-08-21 16:45:10 +01:00
parent db64423ca8
commit 0dcf04def9
5 changed files with 42 additions and 4 deletions

View File

@@ -1683,6 +1683,18 @@ def test_dao_update_notifications_by_reference_returns_zero_when_no_notification
assert updated_count == 0
def test_dao_update_notifications_by_reference_set_returned_letter_status(sample_letter_template):
notification = create_notification(template=sample_letter_template, reference='ref')
updated_count = dao_update_notifications_by_reference(
references=['ref'],
update_dict={"status": "returned-letter"}
)
assert updated_count == 1
assert Notification.query.get(notification.id).status == 'returned-letter'
def test_dao_get_notification_by_reference_with_one_match_returns_notification(sample_letter_template, notify_db):
create_notification(template=sample_letter_template, reference='REF1')
notification = dao_get_notification_by_reference('REF1')