Fixed bug where the content header was not being passed onto the post

request. Changed data => json.

Added extra logging to display the error with more detail
This commit is contained in:
Richard Chapman
2018-03-06 14:42:53 +00:00
parent d0df85a602
commit ed9936bba0
2 changed files with 4 additions and 2 deletions

View File

@@ -266,7 +266,7 @@ def _get_png_preview(url, data, notification_id):
resp.content resp.content
)) ))
raise InvalidRequest( raise InvalidRequest(
'Error generating preview letter for {} \nStatus code: {}\n{}'.format( 'Error generating preview letter for {}\nStatus code: {}\n{}'.format(
notification_id, notification_id,
resp.status_code, resp.status_code,
resp.content resp.content

View File

@@ -874,7 +874,9 @@ def test_preview_letter_template_by_id_template_preview_500(
_expected_status=500 _expected_status=500
) )
assert resp['message'] == 'Error generating preview for {}'.format(sample_letter_notification.id) assert 'Status code: 404' in resp['message']
assert 'Error generating preview letter for {}'.format(sample_letter_notification.id) in resp['message']
def test_preview_letter_template_precompiled_pdf_file_type( def test_preview_letter_template_precompiled_pdf_file_type(