mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
make sure letters are handled properly by the v1 api
This commit is contained in:
@@ -468,7 +468,7 @@ class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
|
|||||||
in_data['template'] = in_data.pop('template_history')
|
in_data['template'] = in_data.pop('template_history')
|
||||||
template = get_template_instance(in_data['template'], in_data['personalisation'])
|
template = get_template_instance(in_data['template'], in_data['personalisation'])
|
||||||
in_data['body'] = str(template)
|
in_data['body'] = str(template)
|
||||||
if in_data['template']['template_type'] == models.EMAIL_TYPE:
|
if in_data['template']['template_type'] != models.SMS_TYPE:
|
||||||
in_data['subject'] = template.subject
|
in_data['subject'] = template.subject
|
||||||
in_data['content_char_count'] = None
|
in_data['content_char_count'] = None
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -15,12 +15,20 @@ from tests.app.conftest import sample_notification as create_sample_notification
|
|||||||
from tests.app.db import create_notification, create_api_key
|
from tests.app.db import create_notification, create_api_key
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('type', ('email', 'sms'))
|
@pytest.mark.parametrize('type', ('email', 'sms', 'letter'))
|
||||||
def test_get_notification_by_id(client, sample_notification, sample_email_notification, type):
|
def test_get_notification_by_id(
|
||||||
|
client,
|
||||||
|
sample_notification,
|
||||||
|
sample_email_notification,
|
||||||
|
sample_letter_notification,
|
||||||
|
type
|
||||||
|
):
|
||||||
if type == 'email':
|
if type == 'email':
|
||||||
notification_to_get = sample_email_notification
|
notification_to_get = sample_email_notification
|
||||||
if type == 'sms':
|
if type == 'sms':
|
||||||
notification_to_get = sample_notification
|
notification_to_get = sample_notification
|
||||||
|
if type == 'letter':
|
||||||
|
notification_to_get = sample_letter_notification
|
||||||
|
|
||||||
auth_header = create_authorization_header(service_id=notification_to_get.service_id)
|
auth_header = create_authorization_header(service_id=notification_to_get.service_id)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user