mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
Make error message specific to template type
This commit is contained in:
@@ -1994,14 +1994,20 @@ def test_can_create_email_template_with_emoji(
|
||||
assert mock_create_service_template.called is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize('template_type', (
|
||||
'sms', 'broadcast'
|
||||
@pytest.mark.parametrize('template_type, expected_error', (
|
||||
('sms', (
|
||||
'You cannot use 🍜 in text messages.'
|
||||
)),
|
||||
('broadcast', (
|
||||
'You cannot use 🍜 in broadcasts.'
|
||||
)),
|
||||
))
|
||||
def test_should_not_create_sms_or_broadcast_template_with_emoji(
|
||||
client_request,
|
||||
service_one,
|
||||
mock_create_service_template,
|
||||
template_type,
|
||||
expected_error,
|
||||
):
|
||||
service_one['permissions'] += [template_type]
|
||||
page = client_request.post(
|
||||
@@ -2017,22 +2023,37 @@ def test_should_not_create_sms_or_broadcast_template_with_emoji(
|
||||
},
|
||||
_expected_status=200,
|
||||
)
|
||||
assert "You cannot use 🍜 in text messages." in page.text
|
||||
assert expected_error in page.text
|
||||
assert mock_create_service_template.called is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize('template_type', (
|
||||
'sms', 'broadcast'
|
||||
@pytest.mark.parametrize('template_type, expected_error', (
|
||||
('sms', (
|
||||
'You cannot use 🍔 in text messages.'
|
||||
)),
|
||||
('broadcast', (
|
||||
'You cannot use 🍔 in broadcasts.'
|
||||
)),
|
||||
))
|
||||
def test_should_not_update_sms_template_with_emoji(
|
||||
mocker,
|
||||
client_request,
|
||||
service_one,
|
||||
mock_get_service_template,
|
||||
mock_update_service_template,
|
||||
fake_uuid,
|
||||
template_type,
|
||||
expected_error,
|
||||
):
|
||||
service_one['permissions'] += [template_type]
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_template',
|
||||
return_value=template_json(
|
||||
SERVICE_ONE_ID,
|
||||
fake_uuid,
|
||||
type_=template_type,
|
||||
),
|
||||
)
|
||||
page = client_request.post(
|
||||
'.edit_service_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
@@ -2047,7 +2068,7 @@ def test_should_not_update_sms_template_with_emoji(
|
||||
},
|
||||
_expected_status=200,
|
||||
)
|
||||
assert "You cannot use 🍔 in text messages." in page.text
|
||||
assert expected_error in page.text
|
||||
assert mock_update_service_template.called is False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user