From a3b690fde6b1e7508e8d5d6cec24b806c3a143fa Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 15 May 2020 15:26:53 +0100 Subject: [PATCH] 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 ]