mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Update notification schema to include received letter status
This commit is contained in:
@@ -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)
|
from app.schema_validation.definitions import (uuid, personalisation, letter_personalisation)
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +64,8 @@ get_notifications_request = {
|
|||||||
"status": {
|
"status": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"enum": NOTIFICATION_STATUS_TYPES + [NOTIFICATION_STATUS_LETTER_ACCEPTED]
|
"enum": NOTIFICATION_STATUS_TYPES +
|
||||||
|
[NOTIFICATION_STATUS_LETTER_ACCEPTED + ', ' + NOTIFICATION_STATUS_LETTER_RECEIVED]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"template_type": {
|
"template_type": {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def test_get_notifications_request_invalid_statuses(
|
|||||||
):
|
):
|
||||||
partial_error_status = "is not one of " \
|
partial_error_status = "is not one of " \
|
||||||
"[created, sending, sent, delivered, pending, failed, " \
|
"[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:
|
with pytest.raises(ValidationError) as e:
|
||||||
validate({'status': invalid_statuses + valid_statuses}, get_notifications_request)
|
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]
|
error_messages = [error['message'] for error in errors]
|
||||||
for invalid_status in ["elephant", "giraffe"]:
|
for invalid_status in ["elephant", "giraffe"]:
|
||||||
assert "status {} is not one of [created, sending, sent, delivered, " \
|
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
|
invalid_status
|
||||||
) in error_messages
|
) in error_messages
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user