mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-19 14:03:52 -04:00
Make one-off error refer to correct message type
This was hard coded to say ‘You can’t send to this phone number’ even when you were trying to send an email.
This commit is contained in:
@@ -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 %}
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user