From 8bdc999818f2c69f4ffc9a746b168a485e6ed4a2 Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Mon, 23 Oct 2017 16:23:36 +0100 Subject: [PATCH] Update notification schema to include received letter status --- app/v2/notifications/notification_schemas.py | 10 ++++++++-- .../app/v2/notifications/test_notification_schemas.py | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/v2/notifications/notification_schemas.py b/app/v2/notifications/notification_schemas.py index 2eeddc532..1689a7319 100644 --- a/app/v2/notifications/notification_schemas.py +++ b/app/v2/notifications/notification_schemas.py @@ -1,4 +1,9 @@ -from app.models import NOTIFICATION_STATUS_TYPES, NOTIFICATION_STATUS_LETTER_ACCEPTED, TEMPLATE_TYPES +from app.models import ( + NOTIFICATION_STATUS_TYPES, + NOTIFICATION_STATUS_LETTER_ACCEPTED, + NOTIFICATION_STATUS_LETTER_RECEIVED, + TEMPLATE_TYPES +) from app.schema_validation.definitions import (uuid, personalisation, letter_personalisation) @@ -59,7 +64,8 @@ get_notifications_request = { "status": { "type": "array", "items": { - "enum": NOTIFICATION_STATUS_TYPES + [NOTIFICATION_STATUS_LETTER_ACCEPTED] + "enum": NOTIFICATION_STATUS_TYPES + + [NOTIFICATION_STATUS_LETTER_ACCEPTED + ', ' + NOTIFICATION_STATUS_LETTER_RECEIVED] } }, "template_type": { diff --git a/tests/app/v2/notifications/test_notification_schemas.py b/tests/app/v2/notifications/test_notification_schemas.py index c667def11..6b51b195d 100644 --- a/tests/app/v2/notifications/test_notification_schemas.py +++ b/tests/app/v2/notifications/test_notification_schemas.py @@ -26,7 +26,7 @@ def test_get_notifications_request_invalid_statuses( ): partial_error_status = "is not one of " \ "[created, sending, sent, delivered, pending, failed, " \ - "technical-failure, temporary-failure, permanent-failure, accepted]" + "technical-failure, temporary-failure, permanent-failure, accepted, received]" with pytest.raises(ValidationError) as e: validate({'status': invalid_statuses + valid_statuses}, get_notifications_request) @@ -73,7 +73,7 @@ def test_get_notifications_request_invalid_statuses_and_template_types(): error_messages = [error['message'] for error in errors] for invalid_status in ["elephant", "giraffe"]: assert "status {} is not one of [created, sending, sent, delivered, " \ - "pending, failed, technical-failure, temporary-failure, permanent-failure, accepted]".format( + "pending, failed, technical-failure, temporary-failure, permanent-failure, accepted, received]".format( invalid_status ) in error_messages