diff --git a/app/main/views/agreement.py b/app/main/views/agreement.py index 88fedeb8c..2de1b2873 100644 --- a/app/main/views/agreement.py +++ b/app/main/views/agreement.py @@ -10,12 +10,21 @@ from app.s3_client.s3_mou_client import get_mou @login_required def agreement(): return render_template( - 'views/{}.html'.format(current_user.default_organisation.as_jinja_template), + 'views/agreement/{}.html'.format(current_user.default_organisation.as_jinja_template), owner=current_user.default_organisation.name, navigation_links=features_nav(), ) +@main.route('/services//agreement') +@login_required +def service_agreement(service_id): + return render_template( + 'views/agreement/service-{}.html'.format(current_user.default_organisation.as_jinja_template), + owner=current_user.default_organisation.name, + ) + + @main.route('/agreement.pdf') @login_required def download_agreement(): @@ -37,7 +46,7 @@ def public_agreement(variant): )) return render_template( - 'views/agreement-public.html', + 'views/agreement/agreement-public.html', owner=current_user.default_organisation.name, download_link=url_for('.public_download_agreement', variant=variant), ) diff --git a/app/navigation.py b/app/navigation.py index f1bccc292..ee7a5ac42 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -237,6 +237,7 @@ class HeaderNavigation(Navigation): 'service_add_email_reply_to', 'service_add_letter_contact', 'service_add_sms_sender', + 'service_agreement', 'service_confirm_delete_email_reply_to', 'service_confirm_delete_sms_sender', 'service_dashboard', @@ -368,6 +369,7 @@ class MainNavigation(Navigation): 'service_add_email_reply_to', 'service_add_letter_contact', 'service_add_sms_sender', + 'service_agreement', 'service_confirm_delete_email_reply_to', 'service_confirm_delete_sms_sender', 'service_edit_email_reply_to', @@ -744,6 +746,7 @@ class CaseworkNavigation(Navigation): 'service_add_email_reply_to', 'service_add_letter_contact', 'service_add_sms_sender', + 'service_agreement', 'service_confirm_delete_email_reply_to', 'service_confirm_delete_sms_sender', 'service_dashboard', @@ -1003,6 +1006,7 @@ class OrgNavigation(Navigation): 'service_add_email_reply_to', 'service_add_letter_contact', 'service_add_sms_sender', + 'service_agreement', 'service_confirm_delete_email_reply_to', 'service_confirm_delete_sms_sender', 'service_dashboard', diff --git a/app/templates/views/agreement-choose.html b/app/templates/views/agreement-choose.html deleted file mode 100644 index 592eb9533..000000000 --- a/app/templates/views/agreement-choose.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends "withoutnav_template.html" %} -{% from "components/sub-navigation.html" import sub_navigation %} - -{% block per_page_title %} - GOV.UK Notify data sharing and financial agreement -{% endblock %} - -{% block maincolumn_content %} - -
-
- {{ sub_navigation(navigation_links) }} -
-
- -

- GOV.UK Notify data sharing and financial agreement -

- -

- Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement. -

-

- Crown bodies -

-

- Download the crown agreement. -

-

- Non-crown bodies -

-

- Download the non-crown agreement. -

-
-

- Contact us if you’re - not sure whether your organisation is a crown or non-crown body. -

-
-

- Next steps -

-
    -
  1. - Get the agreement signed by someone who has the authority to do so on behalf of {{ owner or 'your organisation' }}. -
  2. -
  3. - Return the signed copy to notify-support@digital.cabinet-office.gov.uk. -
  4. -
-

- The agreement contains commercially sensitive information, so don’t share it more widely than you need to. -

-
-
- -{% endblock %} diff --git a/app/templates/views/agreement.html b/app/templates/views/agreement.html deleted file mode 100644 index 16f72689d..000000000 --- a/app/templates/views/agreement.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends "withoutnav_template.html" %} -{% from "components/sub-navigation.html" import sub_navigation %} - -{% block per_page_title %} - GOV.UK Notify data sharing and financial agreement -{% endblock %} - -{% block maincolumn_content %} - -
-
- {{ sub_navigation(navigation_links) }} -
-
- -

- GOV.UK Notify data sharing and financial agreement -

- -

- Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement. -

-
    -
  1. - Download the agreement. -
  2. -
  3. - Get it signed by someone who has the authority to do so on behalf of {{ owner }}. -
  4. -
  5. - Return the signed copy to notify-support@digital.cabinet-office.gov.uk. -
  6. -
-

- The agreement contains commercially sensitive information, so don’t share it more widely than you need to. -

- -
-
- -{% endblock %} diff --git a/app/templates/views/agreement/_agreement-choose.html b/app/templates/views/agreement/_agreement-choose.html new file mode 100644 index 000000000..4538dad62 --- /dev/null +++ b/app/templates/views/agreement/_agreement-choose.html @@ -0,0 +1,35 @@ +

+ Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement. +

+

+ Crown bodies +

+

+ Download the crown agreement. +

+

+ Non-crown bodies +

+

+ Download the non-crown agreement. +

+
+

+ Contact us if you’re + not sure whether your organisation is a crown or non-crown body. +

+
+

+ Next steps +

+
    +
  1. + Get the agreement signed by someone who has the authority to do so on behalf of {{ owner or 'your organisation' }}. +
  2. +
  3. + Return the signed copy to notify-support@digital.cabinet-office.gov.uk. +
  4. +
+

+ The agreement contains commercially sensitive information, so don’t share it more widely than you need to. +

diff --git a/app/templates/views/agreement/_agreement-signed.html b/app/templates/views/agreement/_agreement-signed.html new file mode 100644 index 000000000..35819b126 --- /dev/null +++ b/app/templates/views/agreement/_agreement-signed.html @@ -0,0 +1,8 @@ +

+ Your organisation ({{ owner }}) has already accepted the GOV.UK + Notify data sharing and financial agreement. You can + download a copy. +

+

+ The agreement contains commercially sensitive information, so don’t share it more widely than you need to. +

diff --git a/app/templates/views/agreement/_agreement.html b/app/templates/views/agreement/_agreement.html new file mode 100644 index 000000000..2e462192a --- /dev/null +++ b/app/templates/views/agreement/_agreement.html @@ -0,0 +1,17 @@ +

+ Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement. +

+
    +
  1. + Download the agreement. +
  2. +
  3. + Get it signed by someone who has the authority to do so on behalf of {{ owner }}. +
  4. +
  5. + Return the signed copy to notify-support@digital.cabinet-office.gov.uk. +
  6. +
+

+ The agreement contains commercially sensitive information, so don’t share it more widely than you need to. +

diff --git a/app/templates/views/agreement/agreement-choose.html b/app/templates/views/agreement/agreement-choose.html new file mode 100644 index 000000000..9f0d6ae5f --- /dev/null +++ b/app/templates/views/agreement/agreement-choose.html @@ -0,0 +1,25 @@ +{% extends "withoutnav_template.html" %} +{% from "components/sub-navigation.html" import sub_navigation %} + +{% block per_page_title %} + GOV.UK Notify data sharing and financial agreement +{% endblock %} + +{% block maincolumn_content %} + +
+
+ {{ sub_navigation(navigation_links) }} +
+
+ +

+ GOV.UK Notify data sharing and financial agreement +

+ + {% include 'views/agreement/_agreement-choose.html'%} + +
+
+ +{% endblock %} diff --git a/app/templates/views/agreement-public.html b/app/templates/views/agreement/agreement-public.html similarity index 100% rename from app/templates/views/agreement-public.html rename to app/templates/views/agreement/agreement-public.html diff --git a/app/templates/views/agreement-signed.html b/app/templates/views/agreement/agreement-signed.html similarity index 58% rename from app/templates/views/agreement-signed.html rename to app/templates/views/agreement/agreement-signed.html index b38c76193..4cd1c6946 100644 --- a/app/templates/views/agreement-signed.html +++ b/app/templates/views/agreement/agreement-signed.html @@ -17,14 +17,8 @@ GOV.UK Notify data sharing and financial agreement -

- Your organisation ({{ owner }}) has already accepted the GOV.UK - Notify data sharing and financial agreement. You can - download a copy. -

-

- The agreement contains commercially sensitive information, so don’t share it more widely than you need to. -

+ {% include 'views/agreement/_agreement-signed.html' %} + diff --git a/app/templates/views/agreement/agreement.html b/app/templates/views/agreement/agreement.html new file mode 100644 index 000000000..a5fbfcacd --- /dev/null +++ b/app/templates/views/agreement/agreement.html @@ -0,0 +1,25 @@ +{% extends "withoutnav_template.html" %} +{% from "components/sub-navigation.html" import sub_navigation %} + +{% block per_page_title %} + GOV.UK Notify data sharing and financial agreement +{% endblock %} + +{% block maincolumn_content %} + +
+
+ {{ sub_navigation(navigation_links) }} +
+
+ +

+ GOV.UK Notify data sharing and financial agreement +

+ + {% include 'views/agreement/_agreement.html'%} + +
+
+ +{% endblock %} diff --git a/app/templates/views/agreement/service-agreement-choose.html b/app/templates/views/agreement/service-agreement-choose.html new file mode 100644 index 000000000..5cddbc94d --- /dev/null +++ b/app/templates/views/agreement/service-agreement-choose.html @@ -0,0 +1,23 @@ +{% extends "withnav_template.html" %} +{% from "components/page-header.html" import page_header %} + +{% block service_page_title %} + GOV.UK Notify data sharing and financial agreement +{% endblock %} + +{% block maincolumn_content %} + +
+
+ + {{ page_header( + 'GOV.UK Notify data sharing and financial agreement', + back_link=url_for('main.request_to_go_live', service_id=current_service.id) + )}} + + {% include 'views/agreement/_agreement-choose.html'%} + +
+
+ +{% endblock %} diff --git a/app/templates/views/agreement/service-agreement-signed.html b/app/templates/views/agreement/service-agreement-signed.html new file mode 100644 index 000000000..9dac55925 --- /dev/null +++ b/app/templates/views/agreement/service-agreement-signed.html @@ -0,0 +1,23 @@ +{% extends "withnav_template.html" %} +{% from "components/page-header.html" import page_header %} + +{% block service_page_title %} + GOV.UK Notify data sharing and financial agreement +{% endblock %} + +{% block maincolumn_content %} + +
+
+ + {{ page_header( + 'GOV.UK Notify data sharing and financial agreement', + back_link=url_for('main.request_to_go_live', service_id=current_service.id) + )}} + + {% include 'views/agreement/_agreement-signed.html' %} + +
+
+ +{% endblock %} diff --git a/app/templates/views/agreement/service-agreement.html b/app/templates/views/agreement/service-agreement.html new file mode 100644 index 000000000..2d147154d --- /dev/null +++ b/app/templates/views/agreement/service-agreement.html @@ -0,0 +1,23 @@ +{% extends "withnav_template.html" %} +{% from "components/page-header.html" import page_header %} + +{% block service_page_title %} + GOV.UK Notify data sharing and financial agreement +{% endblock %} + +{% block maincolumn_content %} + +
+
+ + {{ page_header( + 'GOV.UK Notify data sharing and financial agreement', + back_link=url_for('main.request_to_go_live', service_id=current_service.id) + )}} + + {% include 'views/agreement/_agreement.html'%} + +
+
+ +{% endblock %} 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 3205dd6ca..d6fa61fdd 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -52,7 +52,7 @@ {{ task_list_item( agreement_signed, 'Sign our data sharing and financial agreement', - url_for('main.agreement'), + url_for('main.service_agreement', service_id=current_service.id), ) }} {% endif %} {% endcall %} diff --git a/tests/app/main/views/test_agreement.py b/tests/app/main/views/test_agreement.py index 0b3806c15..cb284d681 100644 --- a/tests/app/main/views/test_agreement.py +++ b/tests/app/main/views/test_agreement.py @@ -4,7 +4,7 @@ from io import BytesIO import pytest from flask import url_for -from tests.conftest import mock_get_organisation_by_domain +from tests.conftest import SERVICE_ONE_ID, mock_get_organisation_by_domain class _MockS3Object(): @@ -16,6 +16,22 @@ class _MockS3Object(): return {'Body': BytesIO(self.data)} +@pytest.mark.parametrize('endpoint, extra_args, link_selector, expected_back_links', [ + ( + 'main.agreement', + {}, + 'main .column-two-thirds a', + [] + ), + ( + 'main.service_agreement', + {'service_id': SERVICE_ONE_ID}, + 'main .column-five-sixths a', + [ + partial(url_for, 'main.request_to_go_live', service_id=SERVICE_ONE_ID) + ] + ), +]) @pytest.mark.parametrize('agreement_signed, crown, expected_links', [ ( True, True, @@ -44,17 +60,23 @@ def test_show_agreement_page( client_request, mocker, fake_uuid, + mock_has_jobs, agreement_signed, crown, expected_links, + endpoint, + extra_args, + link_selector, + expected_back_links, ): mock_get_organisation_by_domain( mocker, crown=crown, agreement_signed=agreement_signed, ) - page = client_request.get('main.agreement') - links = page.select('main .column-two-thirds a') + expected_links = expected_back_links + expected_links + page = client_request.get(endpoint, **extra_args) + links = page.select(link_selector) assert len(links) == len(expected_links) for index, link in enumerate(links): assert link['href'] == expected_links[index]()