diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 092825c73..5969d20c9 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -25,8 +25,12 @@ {% if current_user.has_permissions('manage_api_keys', 'manage_service') %}
  • Settings
  • {% endif %} - {% if current_user.has_permissions('manage_api_keys') and not current_service.has_permission('broadcast') %} -
  • API integration
  • + {% if current_user.has_permissions('manage_api_keys') %} + {% if current_service.has_permission('broadcast') %} +
  • API integration
  • + {% else %} +
  • API integration
  • + {% endif %} {% endif %} {% elif current_user.has_permissions(allow_org_user=True) %}
  • Usage
  • diff --git a/tests/app/test_navigation.py b/tests/app/test_navigation.py index 01e3769bf..81a6ea634 100644 --- a/tests/app/test_navigation.py +++ b/tests/app/test_navigation.py @@ -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,