From d71269ca87b8497197c2768079da5dc2ec9d67f6 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Jul 2016 11:37:09 +0100 Subject: [PATCH] Hide download CSV link when in the tour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is really no point to downloading the CSV file of delivery info when you’re in the tour. It’s just distracting at this point. --- .../partials/jobs/notifications.html | 2 +- tests/app/main/views/test_jobs.py | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/templates/partials/jobs/notifications.html b/app/templates/partials/jobs/notifications.html index 0ba32b741..1148f8752 100644 --- a/app/templates/partials/jobs/notifications.html +++ b/app/templates/partials/jobs/notifications.html @@ -4,7 +4,7 @@
{% endif %} - {% if notifications %} + {% if notifications and request.args.get('help', '0') == '0' %}

Download as a CSV file   diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index d6922f0a3..850a6f80a 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -99,6 +99,34 @@ def test_should_show_page_for_one_job( ) +def test_should_show_not_show_csv_download_in_tour( + app_, + service_one, + active_user_with_permissions, + mock_get_service_template, + mock_get_service_statistics, + mock_get_job, + mocker, + mock_get_notifications, + fake_uuid +): + with app_.test_request_context(), app_.test_client() as client: + client.login(active_user_with_permissions, mocker, service_one) + response = client.get(url_for( + 'main.view_job', + service_id=service_one['id'], + job_id=fake_uuid, + help=3 + )) + + assert response.status_code == 200 + assert url_for( + 'main.view_job_csv', + service_id=service_one['id'], + job_id=fake_uuid + ) not in response.get_data(as_text=True) + + @freeze_time("2016-01-01 11:09:00.061258") def test_should_show_updates_for_one_job_as_json( app_,