From de6ed990060e8f065c52b41d48c734338a1ea4a5 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 8 Feb 2016 12:30:01 +0000 Subject: [PATCH] Restore template content when deleting template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the template content was renamed in 9ee8610da0704215d96602e34ac77b998e055373 I missed doing the same change for the delete template route. This commit does the same fix, so that template content is still visible when you’re about to delete a template (so you can make sure it’s the right one). --- app/main/views/templates.py | 1 + tests/app/main/views/test_templates.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 38d175a92..6c9817115 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -92,6 +92,7 @@ def delete_service_template(service_id, template_id): else: raise e + template['template_content'] = template['content'] form = TemplateForm(**template) if request.method == 'POST': diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index fb2548a65..47af74f9f 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -95,8 +95,11 @@ def test_should_show_delete_template_page(app_, service_id=service_id, template_id=template_id)) + content = response.get_data(as_text=True) assert response.status_code == 200 - assert 'Are you sure' in response.get_data(as_text=True) + assert 'Are you sure' in content + assert 'Two week reminder' in content + assert 'Your vehicle tax is about to expire' in content mock_get_service_template.assert_called_with( service_id, template_id)