remove letters from v2/notifications

This commit is contained in:
stvnrlly
2023-02-27 17:04:06 -05:00
parent 2b401c2a02
commit 63e288ae3e
4 changed files with 5 additions and 65 deletions

View File

@@ -36,20 +36,6 @@ def create_post_email_response_from_notification(
return resp
def create_post_letter_response_from_notification(
notification_id, client_reference, template_id, template_version, service_id,
content, subject, url_root
):
resp = __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
)
resp['content'] = {
"body": content,
"subject": subject
}
return resp
def __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
):

View File

@@ -1,6 +1,4 @@
from app.models import (
NOTIFICATION_STATUS_LETTER_ACCEPTED,
NOTIFICATION_STATUS_LETTER_RECEIVED,
NOTIFICATION_STATUS_TYPES,
NOTIFICATION_TYPES,
)
@@ -48,7 +46,7 @@ get_notification_response = {
"line_5": {"type": ["string", "null"]},
"line_6": {"type": ["string", "null"]},
"postcode": {"type": ["string", "null"]},
"type": {"enum": ["sms", "letter", "email"]},
"type": {"enum": ["sms", "email"]},
"status": {"type": "string"},
"template": template,
"body": {"type": "string"},
@@ -75,8 +73,7 @@ get_notifications_request = {
"status": {
"type": "array",
"items": {
"enum": NOTIFICATION_STATUS_TYPES +
[NOTIFICATION_STATUS_LETTER_ACCEPTED + ', ' + NOTIFICATION_STATUS_LETTER_RECEIVED]
"enum": NOTIFICATION_STATUS_TYPES
}
},
"template_type": {
@@ -216,46 +213,3 @@ post_email_response = {
},
"required": ["id", "content", "uri", "template"]
}
post_letter_request = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST letter notification schema",
"type": "object",
"title": "POST v2/notifications/letter",
"properties": {
"reference": {"type": "string"},
"template_id": uuid,
"personalisation": personalisation
},
"required": ["template_id", "personalisation"],
"additionalProperties": False
}
letter_content = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Letter content for POST letter notification",
"type": "object",
"title": "notification letter content",
"properties": {
"body": {"type": "string"},
"subject": {"type": "string"}
},
"required": ["body", "subject"]
}
post_letter_response = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "POST sms notification response schema",
"type": "object",
"title": "response v2/notifications/letter",
"properties": {
"id": uuid,
"reference": {"type": ["string", "null"]},
"content": letter_content,
"uri": {"type": "string", "format": "uri"},
"template": template,
# letters cannot be scheduled
"scheduled_for": {"type": "null"}
},
"required": ["id", "content", "uri", "template"]
}

View File

@@ -382,7 +382,7 @@ def test_get_all_notifications_filter_by_status_invalid_status(client, sample_no
assert len(json_response['errors']) == 1
assert json_response['errors'][0]['message'] == "status elephant is not one of [cancelled, created, sending, " \
"sent, delivered, pending, failed, technical-failure, temporary-failure, permanent-failure, " \
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter, accepted, received]"
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter]"
def test_get_all_notifications_filter_by_multiple_statuses(client, sample_template):

View File

@@ -45,7 +45,7 @@ def test_get_notifications_request_invalid_statuses(
partial_error_status = "is not one of " \
"[cancelled, created, sending, sent, delivered, pending, failed, " \
"technical-failure, temporary-failure, permanent-failure, pending-virus-check, " \
"validation-failed, virus-scan-failed, returned-letter, accepted, received]"
"validation-failed, virus-scan-failed, returned-letter]"
with pytest.raises(ValidationError) as e:
validate({'status': invalid_statuses + valid_statuses}, get_notifications_request)
@@ -93,7 +93,7 @@ def test_get_notifications_request_invalid_statuses_and_template_types():
for invalid_status in ["elephant", "giraffe"]:
assert "status {} is not one of [cancelled, created, sending, sent, delivered, " \
"pending, failed, technical-failure, temporary-failure, permanent-failure, " \
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter, accepted, received]".format(
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter]".format(
invalid_status
) in error_messages