Warn users trying to use a personalised template

Since contact lists only store the email address or phone number, this
won’t work. So we should warn people, and highlight that the
personalisation in the template is the problem, since this is what they
will need to change.
This commit is contained in:
Chris Hill-Scott
2020-03-16 10:34:05 +00:00
parent 31d2fd9b58
commit 8ba75cf6ba
3 changed files with 54 additions and 8 deletions

View File

@@ -3928,6 +3928,34 @@ def test_choose_from_contact_list(
)
def test_choose_from_contact_list_with_personalised_template(
mocker,
client_request,
mock_get_contact_lists,
fake_uuid,
):
template = create_template(
content="Hey ((name)) ((thing)) is happening"
)
mocker.patch(
'app.service_api_client.get_service_template',
return_value={'data': template},
)
page = client_request.get(
'main.choose_from_contact_list',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
)
assert [
normalize_spaces(p.text) for p in page.select('main p')
] == [
'You cannot use a saved contact list with this template because '
'it is personalised with ((name)) and ((thing)).',
'Saved contact lists can only store email addresses or phone numbers.',
]
assert not page.select('table')
def test_choose_from_contact_list_with_no_lists(
mocker,
client_request,