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, ):