From e56c2d28b0a4a821f62bdb230015aed609ac3e01 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 21 Apr 2020 10:59:35 +0100 Subject: [PATCH] Fix letter branding preview Template preview requires `template_type` to be passed in now. --- app/main/views/templates.py | 3 ++- tests/app/main/views/test_templates.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 44649345f..7b2e36046 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -248,7 +248,8 @@ def letter_branding_preview_image(filename): 'The point of using Lorem Ipsum is that it has a more-or-less ' 'normal distribution of letters, as opposed to using ‘Content ' 'here, content here’, making it look like readable English.' - ) + ), + 'template_type': 'letter', } filename = None if filename == 'no-branding' else filename diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index b6f56e24d..d1162eae8 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -845,7 +845,14 @@ def test_letter_branding_preview_image( url_for('no_cookie.letter_branding_preview_image', filename=original_filename) ) - mocked_preview.assert_called_with(ANY, new_filename) + mocked_preview.assert_called_with( + { + 'subject': 'An example letter', + 'content': ANY, + 'template_type': 'letter', + }, + new_filename, + ) assert resp.get_data(as_text=True) == 'foo'