Only show the link to use list if service has lists

Most services won’t be interested in the contact list feature, so we
shouldn’t clutter up the interface with the extra link.
This commit is contained in:
Chris Hill-Scott
2020-03-16 10:14:11 +00:00
parent 6c2021aeb2
commit 31d2fd9b58
3 changed files with 33 additions and 1 deletions

View File

@@ -1424,6 +1424,7 @@ def test_platform_admin_has_link_to_use_existing_list(
client_request,
mock_get_service_template,
mock_has_jobs,
mock_get_contact_lists,
fake_uuid,
user,
):
@@ -1465,6 +1466,32 @@ def test_platform_admin_has_link_to_use_existing_list(
]
def test_no_link_to_use_existing_list_for_service_without_lists(
mocker,
client_request,
mock_get_service_template,
mock_has_jobs,
fake_uuid,
):
mocker.patch(
'app.models.contact_list.ContactLists.client_method',
return_value=[],
)
client_request.login(create_platform_admin_user())
page = client_request.get(
'main.send_one_off',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_follow_redirects=True,
)
assert [
link.text for link in page.select('form a')
] == [
'Upload a list of phone numbers',
'Use my phone number',
]
@pytest.mark.parametrize('user', (
create_active_user_with_permissions(),
create_active_caseworking_user(),