From 8bb15e7a58484d4a13df3b19b861598b27846ce1 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 3 Feb 2017 09:44:58 +0000 Subject: [PATCH 1/2] Handle partial letter addresses more gracefully Brings in: - [x] https://github.com/alphagov/notifications-utils/pull/108 Specifically, see these tests for detail of what happens when someone only fills in some of the required/not required lines of an address: https://github.com/alphagov/notifications-utils/pull/108/commits/9e6cb14a5c3b328efa03c1f88d457e2d1c972a52#diff-e5050dea996611c8bdf32cfe6e8214cdR264 --- requirements.txt | 2 +- tests/app/main/views/test_send.py | 4 +++- tests/app/main/views/test_templates.py | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0198556a2..2d4aa0c47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,4 +29,4 @@ whitenoise==1.0.6 #manages static assets # pin to minor version 3.1.x notifications-python-client>=3.1,<3.2 -git+https://github.com/alphagov/notifications-utils.git@13.2.1#egg=notifications-utils==13.2.1 +git+https://github.com/alphagov/notifications-utils.git@13.3.0#egg=notifications-utils==13.3.0 diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 97b7fd2f3..d01e8029d 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -444,8 +444,10 @@ def test_should_show_preview_letter_message( assert response.status_code == 200 assert response.content_type == expected_content_type mock_get_service_letter_template.assert_called_with(service_id, template_id) + assert mock_letter_preview.call_args[0][0]['subject'] == ( + 'Subject' + ) assert mock_letter_preview.call_args[0][0]['message'] == ( - '

Subject

\n' '

Template <em>content</em> with & entity

' ) diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index c6b3e13ba..162198432 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -100,10 +100,10 @@ def test_should_show_preview_letter_templates( assert response.status_code == 200 assert response.content_type == expected_content_type mock_get_service_email_template.assert_called_with(service_id, template_id, **extra_view_args) - print(mock_letter_preview) - print(mock_letter_preview.call_args) + assert mock_letter_preview.call_args[0][0]['subject'] == ( + "Your ((thing)) is due soon" + ) assert mock_letter_preview.call_args[0][0]['message'] == ( - "

Your ((thing)) is due soon

\n" "

Your vehicle tax expires on ((date))

" ) From df6c8997966e27a40a7275f2025488f8cae0d55a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 6 Feb 2017 11:36:38 +0000 Subject: [PATCH 2/2] Fix XSS vulnarability with emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rolling this into the same PR because it’s just a version bump. Brings in: - [ ] https://github.com/alphagov/notifications-utils/pull/113 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2d4aa0c47..6b9fd0c54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,4 +29,4 @@ whitenoise==1.0.6 #manages static assets # pin to minor version 3.1.x notifications-python-client>=3.1,<3.2 -git+https://github.com/alphagov/notifications-utils.git@13.3.0#egg=notifications-utils==13.3.0 +git+https://github.com/alphagov/notifications-utils.git@13.3.1#egg=notifications-utils==13.3.1