From 2f0e3f39d3c0932c43ef68048ef0ced7f6d897d8 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 22 Dec 2021 11:32:53 +0000 Subject: [PATCH] =?UTF-8?q?Hide=20=E2=80=98Download=20this=20report?= =?UTF-8?q?=E2=80=99=20link=20when=20no=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an organisation doesn’t have any live services then there’s no data to download. To make things less confusing we should hide the link in this case. This commit also modifies the existing test so that the assertions are consistent. --- .../views/organisations/organisation/index.html | 12 ++++++------ .../main/views/organisations/test_organisations.py | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/templates/views/organisations/organisation/index.html b/app/templates/views/organisations/organisation/index.html index ae9c27b48..3c555c3d9 100644 --- a/app/templates/views/organisations/organisation/index.html +++ b/app/templates/views/organisations/organisation/index.html @@ -110,12 +110,12 @@ {{ current_org.name }} has no live services on GOV.UK Notify

+ {% else %} +
+

+ Download this report +

+
{% endif %} -
-

- Download this report -

-
- {% endblock %} diff --git a/tests/app/main/views/organisations/test_organisations.py b/tests/app/main/views/organisations/test_organisations.py index 7174d30bd..80b263600 100644 --- a/tests/app/main/views/organisations/test_organisations.py +++ b/tests/app/main/views/organisations/test_organisations.py @@ -92,6 +92,7 @@ def test_view_organisation_shows_the_correct_organisation( assert normalize_spaces(page.select_one('.govuk-hint').text) == ( 'Test 1 has no live services on GOV.UK Notify' ) + assert not page.select('a[download]') def test_page_to_create_new_organisation( @@ -668,7 +669,8 @@ def test_organisation_services_links_to_downloadable_report( client_request.login(active_user_with_permissions) page = client_request.get('.organisation_dashboard', org_id=ORGANISATION_ID) - link_to_report = page.find('a', text="Download this report") + link_to_report = page.select_one('a[download]') + assert normalize_spaces(link_to_report.text) == 'Download this report' assert link_to_report.attrs["href"] == url_for( '.download_organisation_usage_report', org_id=ORGANISATION_ID,