From 85dbe19611e7b74c20ba559ecb4871ca99c4469a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 15 May 2020 12:24:50 +0100 Subject: [PATCH 1/3] Add envelope for international letters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit International letters aren’t sent by first or second class post. In keeping with the little touch of skeumorphism, let’s label them with the commonly recognised marker of international mail instead. --- app/assets/images/envelope-international.svg | 70 +++++++++++++++++++ app/assets/stylesheets/components/letter.scss | 4 ++ 2 files changed, 74 insertions(+) create mode 100644 app/assets/images/envelope-international.svg diff --git a/app/assets/images/envelope-international.svg b/app/assets/images/envelope-international.svg new file mode 100644 index 000000000..4bebb1dce --- /dev/null +++ b/app/assets/images/envelope-international.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/stylesheets/components/letter.scss b/app/assets/stylesheets/components/letter.scss index 84503da16..d23408248 100644 --- a/app/assets/stylesheets/components/letter.scss +++ b/app/assets/stylesheets/components/letter.scss @@ -70,6 +70,10 @@ $iso-paper-ratio: 141.42135624%; background-image: file-url('envelope-2nd-class.svg'); } + &-international { + background-image: file-url('envelope-international.svg'); + } + .letter-sent &:hover { background-color: transparent; border-color: transparent; From 73fe640c9cc87914603f8c5fe6cf4e147d54cd74 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 15 May 2020 12:47:34 +0100 Subject: [PATCH 2/3] Bump utils to 39.1.0 Allows letters to be previewed with international postage --- requirements-app.txt | 2 +- requirements.txt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements-app.txt b/requirements-app.txt index c2c1d11ed..b9baba9f4 100644 --- a/requirements-app.txt +++ b/requirements-app.txt @@ -23,5 +23,5 @@ notifications-python-client==5.5.1 awscli-cwlogs>=1.4,<1.5 itsdangerous==1.1.0 -git+https://github.com/alphagov/notifications-utils.git@39.0.1#egg=notifications-utils==39.0.1 +git+https://github.com/alphagov/notifications-utils.git@39.1.0#egg=notifications-utils==39.1.0 git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha diff --git a/requirements.txt b/requirements.txt index aaf4d053c..377da5a7e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,14 +25,14 @@ notifications-python-client==5.5.1 awscli-cwlogs>=1.4,<1.5 itsdangerous==1.1.0 -git+https://github.com/alphagov/notifications-utils.git@39.0.1#egg=notifications-utils==39.0.1 +git+https://github.com/alphagov/notifications-utils.git@39.1.0#egg=notifications-utils==39.1.0 git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha ## The following requirements were added by pip freeze: -awscli==1.18.53 +awscli==1.18.60 bleach==3.1.4 boto3==1.10.38 -botocore==1.16.3 +botocore==1.16.10 certifi==2020.4.5.1 chardet==3.0.4 click==7.1.2 @@ -47,7 +47,7 @@ greenlet==0.4.15 idna==2.9 jdcal==1.4.1 Jinja2==2.11.2 -jmespath==0.9.5 +jmespath==0.10.0 lml==0.0.9 lxml==4.5.0 MarkupSafe==1.1.1 @@ -63,7 +63,7 @@ PyPDF2==1.26.0 python-dateutil==2.8.1 python-json-logger==0.1.11 PyYAML==5.3.1 -redis==3.5.0 +redis==3.5.2 requests==2.23.0 rsa==3.4.2 s3transfer==0.3.3 From a3b690fde6b1e7508e8d5d6cec24b806c3a143fa Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 15 May 2020 15:26:53 +0100 Subject: [PATCH 3/3] Test notification page shows international postage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just to make sure we’re passing the right postage argument through to the `LetterPreviewTemplate` constructor. --- tests/app/main/views/test_notifications.py | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 4985af524..3c4c5a8cb 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -515,16 +515,41 @@ def test_notification_page_does_not_show_cancel_link_for_letter_which_cannot_be_ assert 'Cancel sending this letter' not in normalize_spaces(page.text) +@pytest.mark.parametrize('postage, expected_postage_text, expected_class_value, expected_delivery', ( + ( + 'first', + 'Postage: first class', + 'letter-postage-first', + 'Estimated delivery date: Tuesday 5 January', + ), + ( + 'europe', + 'Postage: international', + 'letter-postage-international', + 'Estimated delivery date: Wednesday 6 January', + ), + ( + 'rest-of-world', + 'Postage: international', + 'letter-postage-international', + 'Estimated delivery date: Wednesday 6 January', + ), +)) @freeze_time("2016-01-01 18:00") -def test_notification_page_shows_page_for_first_class_letter_notification( +def test_notification_page_shows_page_for_other_postage_classes( client_request, mocker, fake_uuid, + postage, + expected_postage_text, + expected_class_value, + expected_delivery, ): notification = create_notification( notification_status='pending-virus-check', template_type='letter', - postage='first') + postage=postage, + ) mocker.patch('app.notification_api_client.get_notification', return_value=notification) mocker.patch('app.main.views.notifications.get_page_count_for_letter', return_value=3) @@ -536,13 +561,13 @@ def test_notification_page_shows_page_for_first_class_letter_notification( assert normalize_spaces(page.select('main p:nth-of-type(2)')[0].text) == 'Printing starts tomorrow at 5:30pm' assert normalize_spaces(page.select('main p:nth-of-type(3)')[0].text) == ( - 'Estimated delivery date: Tuesday 5 January' + expected_delivery ) assert normalize_spaces(page.select_one('.letter-postage').text) == ( - 'Postage: first class' + expected_postage_text ) assert page.select_one('.letter-postage')['class'] == [ - 'letter-postage', 'letter-postage-first' + 'letter-postage', expected_class_value ]