From 0c775314bdc0d703295ec4d9044f70ae3bc1e3e1 Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 14 Mar 2018 14:01:08 +0000 Subject: [PATCH] Updated the precompiled response to only include the notification id and the client reference. It could confuse the client consumer so best to remove it from the response altogether. * Respond with only the notification_id and client_reference * Updated the test to check for the response without the template --- app/v2/notifications/post_notifications.py | 18 ++++-------------- .../notifications/test_post_notifications.py | 5 +---- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/app/v2/notifications/post_notifications.py b/app/v2/notifications/post_notifications.py index 9cf8b0cbf..d4c4fd47a 100644 --- a/app/v2/notifications/post_notifications.py +++ b/app/v2/notifications/post_notifications.py @@ -92,20 +92,10 @@ def post_precompiled_letter_notification(): precompiled=True ) - create_resp_partial = functools.partial( - create_post_letter_response_from_notification, - subject=template.subject, - ) - - resp = create_resp_partial( - notification=notification, - content=None, - url_root=request.url_root, - scheduled_for=None, - ) - - # Precompile should be the same as a letter without the template as its auto generated - resp.pop('template', None) + resp = { + 'id': notification.id, + 'reference': notification.client_reference + } 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 aa728c383..e21b4ca68 100644 --- a/tests/app/v2/notifications/test_post_notifications.py +++ b/tests/app/v2/notifications/test_post_notifications.py @@ -760,11 +760,8 @@ def test_post_precompiled_letter_notification_returns_201(client, notify_user, m 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, - 'uri': ANY + 'reference': 'letter-reference' }