Skip to content

Commit

Permalink
Link to send section flow from API Documentation guidance page
Browse files Browse the repository at this point in the history
The link is only visible to platform admins.
  • Loading branch information
CrystalPea committed Oct 3, 2024
1 parent 5c7de42 commit 8513197
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/templates/views/guidance/using-notify/api-documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
{% block content_column_content %}

<h1 class="heading-large">Documentation</h1>

{% if current_user.platform_admin %}
<a href="{{ url_for(".guidance_api_documentation_section") }}"
class="govuk-link govuk-link--no-visited-state"
target="_blank" rel="noopener">
Send a link to docs section
</a>
<p></p>
{% endif %}

<p class="govuk-body">This documentation is for developers who want to integrate the GOV.UK Notify API with a web application or back office system.</p>
<h2 class="heading-medium" id="client-libraries">Client libraries</h2>
<p class="govuk-body">Links to documentation open in a new tab.</p>
Expand Down
14 changes: 14 additions & 0 deletions tests/app/main/views/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 8513197

Please sign in to comment.