From 0d202786d03ed8d9b40aa456512dd1fee4a32710 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 27 Nov 2019 12:11:32 +0000 Subject: [PATCH] Show who the recipient is even in trial mode Trial mode should let you preview the letter the same as live mode, except for being able to actually end the letter. Showing the recipient helps people understand how the feature works. --- app/templates/views/uploads/preview.html | 21 ++++++++++++--------- tests/app/main/views/test_uploads.py | 8 +++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/templates/views/uploads/preview.html b/app/templates/views/uploads/preview.html index 302785693..9d747c8a9 100644 --- a/app/templates/views/uploads/preview.html +++ b/app/templates/views/uploads/preview.html @@ -30,20 +30,23 @@ {{ template|string }} - {% if status == 'valid' and current_service.live %} + {% if status == 'valid' %}

Recipient: {{ recipient }}

- + {% if current_service.live %} + + {% endif %} +
{% endif %} {% endblock %} diff --git a/tests/app/main/views/test_uploads.py b/tests/app/main/views/test_uploads.py index 269efcd2f..046146683 100644 --- a/tests/app/main/views/test_uploads.py +++ b/tests/app/main/views/test_uploads.py @@ -366,7 +366,7 @@ def test_uploaded_letter_preview_does_not_show_send_button_if_service_in_trial_m ): mocker.patch('app.main.views.uploads.service_api_client') mocker.patch('app.main.views.uploads.get_letter_metadata', return_value={ - 'filename': 'my_letter.pdf', 'page_count': '1', 'status': 'valid'}) + 'filename': 'my_letter.pdf', 'page_count': '1', 'status': 'valid', 'recipient': 'The Queen'}) # client_request uses service_one, which is in trial mode page = client_request.get( @@ -382,6 +382,12 @@ def test_uploaded_letter_preview_does_not_show_send_button_if_service_in_trial_m assert normalize_spaces(page.find('h1').text) == 'You cannot send this letter' assert page.find('div', class_='letter-sent') + assert normalize_spaces( + page.select_one('.js-stick-at-bottom-when-scrolling p').text + ) == ( + 'Recipient: The Queen' + ) + assert not page.find('form') assert not page.find('button', {'type': 'submit'})