From ecf0dd7ebb5f41189cbf5274ea005b2466440fa3 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 25 May 2016 09:55:19 +0100 Subject: [PATCH] move platform admin links platform admin page removed "View providers" and "List all services" from the choose service page and the left-hand nav bar --- app/templates/main_nav.html | 6 ------ app/templates/views/choose-service.html | 8 -------- app/templates/views/platform-admin.html | 11 ++++++++++- tests/app/main/views/test_choose_services.py | 20 -------------------- tests/app/main/views/test_dashboard.py | 2 -- tests/app/main/views/test_platform_admin.py | 2 ++ 6 files changed, 12 insertions(+), 37 deletions(-) diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index db5edce4c..aaa761039 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -16,11 +16,5 @@ {% if current_user.has_permissions(['manage_api_keys']) %}
  • API keys
  • {% endif %} - {% if current_user.has_permissions(admin_override=True) %} -
  • List all services
  • - {% endif %} - {% if current_user.has_permissions(admin_override=True) %} -
  • View providers
  • - {% endif %} diff --git a/app/templates/views/choose-service.html b/app/templates/views/choose-service.html index d99e888e1..5087d2a3c 100644 --- a/app/templates/views/choose-service.html +++ b/app/templates/views/choose-service.html @@ -10,14 +10,6 @@

    Choose service

    - {% if current_user.has_permissions(admin_override=True) %} - {{ browse_list([ - { - 'title': 'List all services', - 'link': url_for('.show_all_services') - } - ]) }} - {% endif %} {{ browse_list(services) }} {{ browse_list([ diff --git a/app/templates/views/platform-admin.html b/app/templates/views/platform-admin.html index fe5bb8ce8..aab09d9f3 100644 --- a/app/templates/views/platform-admin.html +++ b/app/templates/views/platform-admin.html @@ -11,6 +11,15 @@ Platform admin - <insert platform admin content here> + {{ browse_list([ + { + 'title': 'List all services', + 'link': url_for('.show_all_services') + }, + { + 'title': 'View providers', + 'link': url_for('.view_providers') + }, + ]) }} {% endblock %} diff --git a/tests/app/main/views/test_choose_services.py b/tests/app/main/views/test_choose_services.py index f7b77b3dc..d4399490a 100644 --- a/tests/app/main/views/test_choose_services.py +++ b/tests/app/main/views/test_choose_services.py @@ -83,23 +83,3 @@ def test_should_redirect_if_not_logged_in(app_): response = client.get(url_for('main.show_all_services_or_dashboard')) assert response.status_code == 302 assert url_for('main.index', _external=True) in response.location - - -def test_should_show_all_services_for_platform_admin_user(app_, - platform_admin_user, - mock_get_services, - mocker): - with app_.test_request_context(): - with app_.test_client() as client: - mocker.patch('app.user_api_client.get_user', return_value=platform_admin_user) - client.login(platform_admin_user) - response = client.get(url_for('main.choose_service')) - - assert response.status_code == 200 - resp_data = response.get_data(as_text=True) - assert 'Choose service' in resp_data - services = mock_get_services.side_effect() - assert mock_get_services.called - assert services['data'][0]['name'] in resp_data - assert services['data'][1]['name'] in resp_data - assert 'List all services' in resp_data diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 2454b63d3..114ae5437 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -266,8 +266,6 @@ def test_menu_all_services_for_platform_admin_user(mocker, service_one, []) page = resp.get_data(as_text=True) - assert url_for('main.show_all_services') in page - assert url_for('main.view_providers') in page assert url_for('main.choose_template', service_id=service_one['id'], template_type='sms') in page assert url_for('main.choose_template', service_id=service_one['id'], template_type='email') in page assert url_for('main.manage_users', service_id=service_one['id']) in page diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py index 37071f7a3..e5eb8e7b5 100644 --- a/tests/app/main/views/test_platform_admin.py +++ b/tests/app/main/views/test_platform_admin.py @@ -32,3 +32,5 @@ def test_should_render_platform_admin_page(app_, platform_admin_user, mocker): assert response.status_code == 200 resp_data = response.get_data(as_text=True) assert 'Platform admin' in resp_data + assert 'List all services' in resp_data + assert 'View providers' in resp_data