diff --git a/app/main/views/index.py b/app/main/views/index.py index 56bdfe03f..ba77fb748 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -9,6 +9,7 @@ from app import convert_to_boolean from app.main import main from app.main.forms import SearchTemplatesForm from app.main.views.sub_navigation_dictionaries import features_nav +from app.utils import GovernmentDomain @main.route('/') @@ -152,7 +153,8 @@ def security(): def terms(): return render_template( 'views/terms-of-use.html', - navigation_links=features_nav() + navigation_links=features_nav(), + agreement_info=GovernmentDomain.from_current_user(), ) diff --git a/app/templates/views/terms-of-use.html b/app/templates/views/terms-of-use.html index 7a1fd95e3..a0cca480e 100644 --- a/app/templates/views/terms-of-use.html +++ b/app/templates/views/terms-of-use.html @@ -15,9 +15,18 @@ Terms of use
To go live on GOV.UK Notify, you must accept our data sharing and financial agreement.
-Contact us to get a copy of the agreement or find out if your organisation has already accepted it.
-To accept these terms of use, you must be the service manager for your service.
+ +By using GOV.UK Notify, you agree to follow our terms of use.
+The service manager for your service has to accept the terms of use when you request to go live on Notify.
+ +Your organisation ({{ agreement_info.owner }}) has already accepted the GOV.UK Notify data sharing and financial agreement.
+ {% else %} +For your service to go live on Notify, your organisation must accept our data sharing and financial agreement.
+Contact us to get a copy of the agreement or find out if your organisation has already accepted it.
+ {% endif %}We agree to:
diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 0c5b05ff6..44ae4f145 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -1,6 +1,7 @@ import pytest from bs4 import BeautifulSoup from flask import url_for +from tests.conftest import active_user_with_permissions, normalize_spaces def test_non_logged_in_user_can_see_homepage( @@ -86,3 +87,48 @@ def test_old_static_pages_redirect( 'main.{}'.format(expected_view), _external=True ) + + +def test_terms_is_generic_if_user_is_not_logged_in( + client +): + response = client.get(url_for('main.terms')) + assert response.status_code == 200 + page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') + + assert normalize_spaces(page.select('main p')[2].text) == ( + 'For your service to go live on Notify, your organisation must accept our data sharing and financial agreement.' + ) + assert normalize_spaces(page.select('main p')[3].text) == ( + 'Contact us to get a copy of the agreement or find out if your organisation has already accepted it.' + ) + + +@pytest.mark.parametrize('email_address, expected_first_paragraph', [ + ( + 'test@cabinet-office.gov.uk', + ( + 'Your organisation (Cabinet Office) has already accepted ' + 'the GOV.UK Notify data sharing and financial agreement.' + ), + ), + ( + 'larry@downing-street.gov.uk', + ( + 'For your service to go live on Notify, your organisation ' + 'must accept our data sharing and financial agreement.' + ), + ), +]) +def test_terms_tells_logged_in_users_what_we_know_about_their_agreement( + mocker, + fake_uuid, + client_request, + email_address, + expected_first_paragraph, +): + user = active_user_with_permissions(fake_uuid) + user.email_address = email_address + mocker.patch('app.user_api_client.get_user', return_value=user) + page = client_request.get('main.terms') + assert normalize_spaces(page.select('main p')[2].text) == expected_first_paragraph