Format letter statuses so they make more sense to our users

This commit is contained in:
Pea Tyczynska
2019-01-07 15:17:09 +00:00
parent 36656fd6ba
commit b8318c491b
2 changed files with 16 additions and 5 deletions

View File

@@ -67,11 +67,18 @@ def test_get_notification(mocker):
)
def test_get_api_notifications_changes_letter_statuses(mocker):
@pytest.mark.parametrize("letter_status, expected_status", [
('created', 'accepted'),
('sending', 'accepted'),
('delivered', 'received'),
('returned-letter', 'received'),
("technical-failure", "technical-failure")
])
def test_get_api_notifications_changes_letter_statuses(mocker, letter_status, expected_status):
service_id = str(uuid.uuid4())
sms_notification = single_notification_json(service_id, notification_type='sms', status='created')
email_notification = single_notification_json(service_id, notification_type='email', status='created')
letter_notification = single_notification_json(service_id, notification_type='letter', status='created')
letter_notification = single_notification_json(service_id, notification_type='letter', status=letter_status)
notis = notification_json(service_id=service_id, rows=0)
notis['notifications'] = [sms_notification, email_notification, letter_notification]
@@ -84,7 +91,7 @@ def test_get_api_notifications_changes_letter_statuses(mocker):
assert ret['notifications'][2]['notification_type'] == 'letter'
assert ret['notifications'][0]['status'] == 'created'
assert ret['notifications'][1]['status'] == 'created'
assert ret['notifications'][2]['status'] == 'accepted'
assert ret['notifications'][2]['status'] == expected_status
def test_update_notification_to_cancelled(mocker):