diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html index 66a840659..19c5d34e4 100644 --- a/app/templates/views/notifications/check.html +++ b/app/templates/views/notifications/check.html @@ -12,7 +12,9 @@ {% call banner_wrapper(type='dangerous') %} {% with count_of_recipients=1, - template_type_label='phone number' + template_type_label=( + 'phone number' if template.template_type == 'sms' else 'email address' + ) %} {% include "partials/check/not-allowed-to-send-to.html" %} {% endwith %} diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 8a9499ee5..f025cae88 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -1940,3 +1940,32 @@ def test_send_notification_shows_error_if_400( assert normalize_spaces(page.select('.banner-dangerous h1')[0].text) == expected_h1 assert normalize_spaces(page.select('.banner-dangerous p')[0].text) == expected_err_details assert not page.find('input[type=submit]') + + +def test_send_notification_shows_email_error_in_trial_mode( + client_request, + fake_uuid, + mocker, + mock_get_service_email_template, +): + mocker.patch( + 'app.notification_api_client.send_notification', + side_effect=HTTPError(response=Mock(status_code=400), message=TRIAL_MODE_MSG) + ) + with client_request.session_transaction() as session: + session['recipient'] = 'test@example.com' + session['placeholders'] = {'date': 'foo', 'thing': 'bar'} + + page = client_request.post( + 'main.send_notification', + service_id=SERVICE_ONE_ID, + template_id=fake_uuid, + _expected_status=200, + ) + + assert normalize_spaces(page.select('.banner-dangerous h1')[0].text) == ( + 'You can’t send to this email address' + ) + assert normalize_spaces(page.select('.banner-dangerous p')[0].text) == ( + 'In trial mode you can only send to yourself and members of your team' + )