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.
This commit is contained in:
Chris Hill-Scott
2019-11-27 12:11:32 +00:00
parent 4fc8f5b5d1
commit 0d202786d0
2 changed files with 19 additions and 10 deletions

View File

@@ -30,20 +30,23 @@
{{ template|string }}
</div>
{% if status == 'valid' and current_service.live %}
{% if status == 'valid' %}
<div class="js-stick-at-bottom-when-scrolling">
<p class="top-gutter-0 bottom-gutter-1-2 send-recipient" title="{{ recipient }}">
Recipient: {{ recipient }}
</p>
<form method="post" enctype="multipart/form-data" action="{{url_for(
'main.send_uploaded_letter',
service_id=current_service.id,
)}}" class='page-footer'>
{{ radios(form.postage, hide_legend=true, inline=True) }}
{{ form.file_id(value=file_id) }}
{{ page_footer("Send 1 letter") }}
</form>
{% if current_service.live %}
<form method="post" enctype="multipart/form-data" action="{{url_for(
'main.send_uploaded_letter',
service_id=current_service.id,
)}}" class='page-footer'>
{{ radios(form.postage, hide_legend=true, inline=True) }}
{{ form.file_id(value=file_id) }}
{{ page_footer("Send 1 letter") }}
</form>
{% endif %}
</div>
{% endif %}
{% endblock %}

View File

@@ -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'})