diff --git a/app/templates/partials/check/trying-to-send-letters-in-trial-mode.html b/app/templates/partials/check/trying-to-send-letters-in-trial-mode.html
new file mode 100644
index 000000000..df585a345
--- /dev/null
+++ b/app/templates/partials/check/trying-to-send-letters-in-trial-mode.html
@@ -0,0 +1,8 @@
+
+ You can’t send
+ {{ 'this letter' if count_of_recipients == 1 else 'these letters' }}
+
+
+ In trial mode you
+ can only preview how your letters will look
+
diff --git a/app/templates/views/check/column-errors.html b/app/templates/views/check/column-errors.html
index 75e2101c7..e91bacc67 100644
--- a/app/templates/views/check/column-errors.html
+++ b/app/templates/views/check/column-errors.html
@@ -109,14 +109,15 @@
{% elif trying_to_send_letters_in_trial_mode %}
-
- You can’t send
- {{ 'this letter' if count_of_recipients == 1 else 'these letters' }}
-
-
- In trial mode you
- can only preview how your letters will look
-
+
+ {% with
+ count_of_recipients=count_of_recipients
+ %}
+ {% call banner_wrapper(type='dangerous') %}
+ {% include "partials/check/trying-to-send-letters-in-trial-mode.html" %}
+ {% endcall %}
+ {% endwith %}
+
{% elif recipients.more_rows_than_can_send %}
diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html
index 99b287757..b0a060c7a 100644
--- a/app/templates/views/notifications/check.html
+++ b/app/templates/views/notifications/check.html
@@ -7,7 +7,18 @@
{% endblock %}
{% block maincolumn_content %}
- {% if error == 'not-allowed-to-send-to' %}
+ {% if template.template_type == 'letter' and current_service.trial_mode %}
+ {% set error = 'trial-mode-letters' %}
+
+ {% with
+ count_of_recipients=1
+ %}
+ {% call banner_wrapper(type='dangerous') %}
+ {% include "partials/check/trying-to-send-letters-in-trial-mode.html" %}
+ {% endcall %}
+ {% endwith %}
+
+ {% elif error == 'not-allowed-to-send-to' %}
{% call banner_wrapper(type='dangerous') %}
{% with
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py
index beeafabc5..7a6e2f502 100644
--- a/tests/app/main/views/test_send.py
+++ b/tests/app/main/views/test_send.py
@@ -1976,14 +1976,19 @@ def test_letter_can_only_be_sent_now(
mocker.patch('app.main.views.send.set_metadata_on_csv_upload')
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=1)
- content = client_request.get(
+ page = client_request.get(
'main.check_messages',
service_id=SERVICE_ONE_ID,
upload_id=fake_uuid,
template_id=fake_uuid,
)
- assert 'name="scheduled_for"' not in content
+ assert 'name="scheduled_for"' not in page
+ assert normalize_spaces(
+ page.select_one('[type=submit]').text
+ ) == (
+ 'Send 1 letter'
+ )
@pytest.mark.parametrize('when', [
@@ -2761,6 +2766,51 @@ def test_one_off_letters_have_download_link(
assert page.select_one('a[download]').text == 'Download as a printable PDF'
+def test_send_one_off_letter_errors_in_trial_mode(
+ client_request,
+ mocker,
+ mock_get_service,
+ mock_get_service_letter_template,
+ mock_has_permissions,
+ fake_uuid,
+ mock_get_users_by_service,
+ mock_get_service_statistics,
+ mock_get_job_doesnt_exist,
+ mock_s3_set_metadata,
+):
+
+ mocker.patch(
+ 'app.main.views.send.get_page_count_for_letter',
+ return_value=5,
+ )
+
+ with client_request.session_transaction() as session:
+ session['recipient'] = None
+ session['placeholders'] = {
+ 'address_line_1': 'First Last',
+ 'address_line_2': '123 Street',
+ 'postcode': 'SW1 1AA',
+ }
+
+ page = client_request.get(
+ 'main.check_notification',
+ service_id=SERVICE_ONE_ID,
+ template_id=fake_uuid,
+ _test_page_title=False,
+ )
+
+ assert normalize_spaces(page.select('.banner-dangerous')) == normalize_spaces(
+ 'You can’t send this letter '
+ 'In trial mode you can only preview how your letters will look'
+ )
+
+ assert len(page.select('.letter img')) == 5
+
+ assert not page.select('[type=submit]')
+ assert page.select_one('.page-footer-back-link').text == 'Back'
+ assert page.select_one('a[download]').text == 'Download as a printable PDF'
+
+
def test_check_messages_shows_over_max_row_error(
logged_in_client,
api_user_active,