From 62caaf8b90dac4e25ea509407ab83c14e81ff5f1 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 3 Oct 2024 12:24:31 +0100 Subject: [PATCH] Link to send section flow from API Documentation guidance page The link is only visible to platform admins. --- .../guidance/using-notify/api-documentation.html | 10 ++++++++++ tests/app/main/views/test_index.py | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/app/templates/views/guidance/using-notify/api-documentation.html b/app/templates/views/guidance/using-notify/api-documentation.html index 764be8d091f..c33789d2dfe 100644 --- a/app/templates/views/guidance/using-notify/api-documentation.html +++ b/app/templates/views/guidance/using-notify/api-documentation.html @@ -10,6 +10,16 @@ {% block content_column_content %}

Documentation

+ + {% if current_user.platform_admin %} + + Send a link to docs section + +

+ {% endif %} +

This documentation is for developers who want to integrate the GOV.UK Notify API with a web application or back office system.

Client libraries

Links to documentation open in a new tab.

diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 1734a051ba6..87b1eb2c176 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -386,6 +386,20 @@ def test_trial_mode_sending_limits(client_request): ] +def test_guidance_api_documentation_links_to_section_flow_for_platform_admins(client_request, platform_admin_user): + client_request.login(platform_admin_user) + + page = client_request.get("main.guidance_api_documentation") + + assert len(page.select('a[href^="{link}"]'.format(link=url_for(".guidance_api_documentation_section")))) == 1 + + +def test_guidance_api_documentation_does_not_link_to_section_flow_for_non_platform_admins(client_request): + page = client_request.get("main.guidance_api_documentation") + + assert len(page.select('a[href^="{link}"]'.format(link=url_for(".guidance_api_documentation_section")))) == 0 + + def test_GET_guidance_api_documentation_section(client_request): page = client_request.get("main.guidance_api_documentation_section")