Update notification schema to include received letter status

This commit is contained in:
Ken Tsang
2017-10-23 16:23:36 +01:00
parent a2b42194cd
commit 8bdc999818
2 changed files with 10 additions and 4 deletions

View File

@@ -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": {

View File

@@ -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