diff --git a/app/schemas.py b/app/schemas.py index 23e99fb5a..ca1e2fb13 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -272,6 +272,8 @@ class NotificationStatusSchema(BaseSchema): if in_data['template']['template_type'] == 'email': in_data['subject'] = template.replaced_subject in_data.pop('personalisation', None) + else: + in_data['body'] = in_data['template']['content'] in_data['template'].pop('content', None) in_data['template'].pop('subject', None) return in_data diff --git a/tests/app/notifications/test_rest.py b/tests/app/notifications/test_rest.py index a7fc33593..41694789d 100644 --- a/tests/app/notifications/test_rest.py +++ b/tests/app/notifications/test_rest.py @@ -35,6 +35,7 @@ def test_get_notification_by_id(notify_api, sample_notification): assert notification['to'] == '+447700900855' assert notification['service'] == str(sample_notification.service_id) assert response.status_code == 200 + assert notification['body'] == "This is a template" # sample_template.content def test_get_notifications_empty_result(notify_api, sample_api_key): @@ -75,6 +76,7 @@ def test_get_all_notifications(notify_api, sample_notification): assert notifications['notifications'][0]['to'] == '+447700900855' assert notifications['notifications'][0]['service'] == str(sample_notification.service_id) + assert notifications['notifications'][0]['body'] == "This is a template" # sample_template.content assert response.status_code == 200