Make it easy to see API keys for broadcast service

This made it easier to debug a problem with the functional tests
due to the fixtures not working correctly [^1]. It's a platform
admin only convenience over knowing the page URL.

We may want to expose the top-level "/api-integration" page but
that will require more work to show which broadcasts were sent with
which key - currently it's oriented around "messages". For now I
think it's useful to see what keys a service has.

[^1]: https://github.com/alphagov/notifications-functional-tests/pull/411#pullrequestreview-920069799
This commit is contained in:
Ben Thorner
2022-03-24 12:29:14 +00:00
parent dd85cf076d
commit b6bc598e8c
2 changed files with 35 additions and 2 deletions

View File

@@ -547,6 +547,35 @@ def test_navigation_for_services_with_broadcast_permission(
]
def test_navigation_for_services_with_broadcast_permission_platform_admin(
mocker,
client_request,
service_one,
mock_get_service_templates,
mock_get_template_folders,
mock_get_api_keys,
platform_admin_user,
):
service_one['permissions'] += ['broadcast']
mocker.patch(
'app.user_api_client.get_user',
return_value=platform_admin_user,
)
page = client_request.get('main.choose_template', service_id=SERVICE_ONE_ID)
assert [
a['href'] for a in page.select('.navigation a')
] == [
'/services/{}/current-alerts'.format(SERVICE_ONE_ID),
'/services/{}/past-alerts'.format(SERVICE_ONE_ID),
'/services/{}/rejected-alerts'.format(SERVICE_ONE_ID),
'/services/{}/templates'.format(SERVICE_ONE_ID),
'/services/{}/users'.format(SERVICE_ONE_ID),
'/services/{}/service-settings'.format(SERVICE_ONE_ID),
'/services/{}/api/keys'.format(SERVICE_ONE_ID),
]
def test_caseworkers_get_caseworking_navigation(
client_request,
mocker,