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
This commit is contained in:
Richard Chapman
2018-03-14 13:16:55 +00:00
parent c6c56f9cdc
commit f3cca07d19
2 changed files with 4 additions and 5 deletions

View File

@@ -104,6 +104,9 @@ def post_precompiled_letter_notification():
scheduled_for=None, 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 return jsonify(resp), 201

View File

@@ -758,16 +758,12 @@ def test_post_precompiled_letter_notification_returns_201(client, notify_user, m
assert notification.billable_units == 3 assert notification.billable_units == 3
resp_json = json.loads(response.get_data(as_text=True)) resp_json = json.loads(response.get_data(as_text=True))
assert resp_json == { assert resp_json == {
'content': {'body': None, 'subject': 'Pre-compiled PDF'}, 'content': {'body': None, 'subject': 'Pre-compiled PDF'},
'id': str(notification.id), 'id': str(notification.id),
'reference': 'letter-reference', 'reference': 'letter-reference',
'scheduled_for': None, 'scheduled_for': None,
'template': {
'id': ANY,
'uri': ANY,
'version': 1
},
'uri': ANY 'uri': ANY
} }