From f3cca07d199783a072d27a1fa08d53789feae36b Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 14 Mar 2018 13:16:55 +0000 Subject: [PATCH] Updated the precompiled response to not include the template. The template in precompiled is only used internally and cannot be accessed from the UI. It could confuse the client consumer so best to remove it from the response altogether. * Remove the template from the dict before returning it and therefore ensuring it still stays similar to letter * Updated the test to check for the response without the template --- app/v2/notifications/post_notifications.py | 3 +++ tests/app/v2/notifications/test_post_notifications.py | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/v2/notifications/post_notifications.py b/app/v2/notifications/post_notifications.py index 7963ee8ce..9cf8b0cbf 100644 --- a/app/v2/notifications/post_notifications.py +++ b/app/v2/notifications/post_notifications.py @@ -104,6 +104,9 @@ def post_precompiled_letter_notification(): scheduled_for=None, ) + # Precompile should be the same as a letter without the template as its auto generated + resp.pop('template', None) + return jsonify(resp), 201 diff --git a/tests/app/v2/notifications/test_post_notifications.py b/tests/app/v2/notifications/test_post_notifications.py index dc7bc173d..aa728c383 100644 --- a/tests/app/v2/notifications/test_post_notifications.py +++ b/tests/app/v2/notifications/test_post_notifications.py @@ -758,16 +758,12 @@ def test_post_precompiled_letter_notification_returns_201(client, notify_user, m assert notification.billable_units == 3 resp_json = json.loads(response.get_data(as_text=True)) + assert resp_json == { 'content': {'body': None, 'subject': 'Pre-compiled PDF'}, 'id': str(notification.id), 'reference': 'letter-reference', 'scheduled_for': None, - 'template': { - 'id': ANY, - 'uri': ANY, - 'version': 1 - }, 'uri': ANY }