From 5dd45da08cc62806ff05dcd33500989911324de5 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 21 Sep 2018 14:43:54 +0100 Subject: [PATCH] Add line about MOU to checklist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2/3 of our incomplete requests to go live are incomplete because the Data Sharing and Financial Agreement isn’t signed. We reckon we can be pushier about this by saying it’s ‘incomplete’ where we know the agreement is signed. Where the agreement is signed we should confirm this, rather than make the line disappear. This is so it makes more sense to someone who sees it as ‘incomplete’, signs it, then comes back to the page. If we don’t know whether or not the agreement is signed we should wait until someone has got in touch with us by requesting to go live to figure it out. So that’s why we’re not showing that line at all. --- app/main/views/service_settings.py | 7 ++- .../service-settings/request-to-go-live.html | 7 +++ tests/app/main/views/test_service_settings.py | 52 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index bb6297dab..ac17ef791 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -179,8 +179,13 @@ def service_name_change_confirm(service_id): @login_required @user_has_permissions('manage_service') def request_to_go_live(service_id): + + agreement_signed = AgreementInfo.from_current_user().agreement_signed + return render_template( - 'views/service-settings/request-to-go-live.html' + 'views/service-settings/request-to-go-live.html', + show_agreement=agreement_signed is not None, + agreement_signed=agreement_signed, ) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index 1f1c4e744..ed1ec0f35 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -39,6 +39,13 @@ url_for('main.service_sms_senders', service_id=current_service.id), ) }} {% endif %} + {% if show_agreement %} + {{ task_list_item( + agreement_signed, + 'Get our data sharing and financial agreement signed', + url_for('main.agreement'), + ) }} + {% endif %} {% endcall %}

You also need to accept our terms of use. diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 263d42eda..85add0402 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -702,6 +702,58 @@ def test_should_check_for_sms_sender_on_go_live( mock_get_sms_senders.assert_called_once_with(SERVICE_ONE_ID) +@pytest.mark.parametrize('email_address, expected_item', ( + pytest.param( + 'test@unknown.gov.uk', + '', + marks=pytest.mark.xfail(raises=IndexError) + ), + ( + 'test@education.gov.uk', + 'Get our data sharing and financial agreement signed Completed', + ), + ( + 'test@aylesbury.gov.uk', + 'Get our data sharing and financial agreement signed Not completed', + ), +)) +def test_should_check_for_mou_on_request_to_go_live( + client_request, + service_one, + mocker, + email_address, + expected_item, +): + mocker.patch( + 'app.main.views.service_settings.user_api_client.get_count_of_users_with_permission', + return_value=0, + ) + mocker.patch( + 'app.main.views.service_settings.service_api_client.count_service_templates', + return_value=0, + ) + mocker.patch( + 'app.main.views.service_settings.service_api_client.get_sms_senders', + return_value=[], + ) + mocker.patch( + 'app.main.views.service_settings.service_api_client.get_reply_to_email_addresses', + return_value=[], + ) + + user = active_user_with_permissions(fake_uuid()) + user.email_address = email_address + client_request.login(user) + + page = client_request.get( + 'main.request_to_go_live', service_id=SERVICE_ONE_ID + ) + assert page.h1.text == 'Before you request to go live' + + checklist_items = page.select('.task-list .task-list-item') + assert normalize_spaces(checklist_items[2].text) == expected_item + + def test_should_show_request_to_go_live( client_request, ):