Allow users of the API to search templates by ID

For someone who has retrieved a template ID from their system the only
way to find it in Notify is:
- hack the URL
- click through every template, visually inspecting the ID shown on the
  page until you find the right one

Neither of these is ideal.

This commit adds searching by ID, for those services who have an API
integration. This means we don’t need to confuse teams who aren’t using
the API by talking about IDs.

This is similar to how we let these teams search for notifications by
reference[1]

1. https://github.com/alphagov/notifications-admin/pull/3223/files
This commit is contained in:
Chris Hill-Scott
2021-04-13 13:59:51 +01:00
parent 69ed9e965a
commit c95b2ef8b3
10 changed files with 142 additions and 8 deletions

View File

@@ -417,6 +417,7 @@ def test_a_page_should_nave_selected_navigation_item(
mock_get_users_by_service,
mock_get_invites_for_service,
mock_get_template_folders,
mock_get_api_keys,
endpoint,
selected_nav_item,
):
@@ -467,6 +468,7 @@ def test_navigation_urls(
client_request,
mock_get_service_templates,
mock_get_template_folders,
mock_get_api_keys,
):
page = client_request.get('main.choose_template', service_id=SERVICE_ONE_ID)
assert [
@@ -487,6 +489,7 @@ def test_navigation_for_services_with_broadcast_permission(
service_one,
mock_get_service_templates,
mock_get_template_folders,
mock_get_api_keys,
):
service_one['permissions'] += ['broadcast']
page = client_request.get('main.choose_template', service_id=SERVICE_ONE_ID)
@@ -508,6 +511,7 @@ def test_caseworkers_get_caseworking_navigation(
mock_get_template_folders,
mock_get_service_templates,
mock_has_no_jobs,
mock_get_api_keys,
active_caseworking_user,
):
mocker.patch(
@@ -527,6 +531,7 @@ def test_caseworkers_see_jobs_nav_if_jobs_exist(
mock_get_template_folders,
mock_has_jobs,
active_caseworking_user,
mock_get_api_keys,
):
mocker.patch(
'app.user_api_client.get_user',