Merge pull request #2943 from alphagov/service-agreement

Add service-specific versions of agreement page
This commit is contained in:
Chris Hill-Scott
2019-05-01 17:07:45 +01:00
committed by GitHub
16 changed files with 222 additions and 113 deletions

View File

@@ -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/<uuid:service_id>/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),
)

View File

@@ -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',

View File

@@ -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 %}
<div class="grid-row">
<div class="column-one-third">
{{ sub_navigation(navigation_links) }}
</div>
<div class="column-two-thirds">
<h1 class="heading-large">
GOV.UK Notify data sharing and financial agreement
</h1>
<p>
Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement.
</p>
<h2 class="heading-small">
Crown bodies
</h2>
<p>
Download the <a href="{{ url_for('main.public_download_agreement', variant='crown') }}">crown agreement</a>.
</p>
<h2 class="heading-small">
Non-crown bodies
</h2>
<p>
Download the <a href="{{ url_for('main.public_download_agreement', variant='non-crown') }}">non-crown agreement</a>.
</p>
<div class="panel panel-border-wide">
<p>
<a href="{{ url_for('main.support') }}">Contact us</a> if youre
not sure whether your organisation is a crown or non-crown body.
</p>
</div>
<h2 class="heading-small">
Next steps
</h2>
<ol class="list list-number">
<li>
Get the agreement signed by someone who has the authority to do so on behalf of {{ owner or 'your organisation' }}.
</li>
<li>
Return the signed copy to <a href="mailto:notify-support@digital.cabinet-office.gov.uk">notify-support@digital.cabinet-office.gov.uk</a>.
</li>
</ol>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>
</div>
</div>
{% endblock %}

View File

@@ -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 %}
<div class="grid-row">
<div class="column-one-third">
{{ sub_navigation(navigation_links) }}
</div>
<div class="column-two-thirds">
<h1 class="heading-large">
GOV.UK Notify data sharing and financial agreement
</h1>
<p>
Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement.
</p>
<ol class="list list-number">
<li>
<a href="{{ url_for('main.download_agreement') }}">Download the agreement</a>.
</li>
<li>
Get it signed by someone who has the authority to do so on behalf of {{ owner }}.
</li>
<li>
Return the signed copy to <a href="mailto:notify-support@digital.cabinet-office.gov.uk">notify-support@digital.cabinet-office.gov.uk</a>.
</li>
</ol>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,35 @@
<p>
Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement.
</p>
<h2 class="heading-small">
Crown bodies
</h2>
<p>
Download the <a href="{{ url_for('main.public_download_agreement', variant='crown') }}">crown agreement</a>.
</p>
<h2 class="heading-small">
Non-crown bodies
</h2>
<p>
Download the <a href="{{ url_for('main.public_download_agreement', variant='non-crown') }}">non-crown agreement</a>.
</p>
<div class="panel panel-border-wide">
<p>
<a href="{{ url_for('main.support') }}">Contact us</a> if youre
not sure whether your organisation is a crown or non-crown body.
</p>
</div>
<h2 class="heading-small">
Next steps
</h2>
<ol class="list list-number">
<li>
Get the agreement signed by someone who has the authority to do so on behalf of {{ owner or 'your organisation' }}.
</li>
<li>
Return the signed copy to <a href="mailto:notify-support@digital.cabinet-office.gov.uk">notify-support@digital.cabinet-office.gov.uk</a>.
</li>
</ol>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>

View File

@@ -0,0 +1,8 @@
<p>
Your organisation ({{ owner }}) has already accepted the GOV.UK
Notify data sharing and financial agreement. You can
<a href="{{ url_for('main.download_agreement') }}">download a copy</a>.
</p>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>

View File

@@ -0,0 +1,17 @@
<p>
Before you can go live on GOV.UK Notify, your organisation needs to agree to our data sharing and financial agreement.
</p>
<ol class="list list-number">
<li>
<a href="{{ url_for('main.download_agreement') }}">Download the agreement</a>.
</li>
<li>
Get it signed by someone who has the authority to do so on behalf of {{ owner }}.
</li>
<li>
Return the signed copy to <a href="mailto:notify-support@digital.cabinet-office.gov.uk">notify-support@digital.cabinet-office.gov.uk</a>.
</li>
</ol>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>

View File

@@ -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 %}
<div class="grid-row">
<div class="column-one-third">
{{ sub_navigation(navigation_links) }}
</div>
<div class="column-two-thirds">
<h1 class="heading-large">
GOV.UK Notify data sharing and financial agreement
</h1>
{% include 'views/agreement/_agreement-choose.html'%}
</div>
</div>
{% endblock %}

View File

@@ -17,14 +17,8 @@
GOV.UK Notify data sharing and financial agreement
</h1>
<p>
Your organisation ({{ owner }}) has already accepted the GOV.UK
Notify data sharing and financial agreement. You can
<a href="{{ url_for('main.download_agreement') }}">download a copy</a>.
</p>
<p>
The agreement contains commercially sensitive information, so dont share it more widely than you need to.
</p>
{% include 'views/agreement/_agreement-signed.html' %}
</div>
</div>

View File

@@ -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 %}
<div class="grid-row">
<div class="column-one-third">
{{ sub_navigation(navigation_links) }}
</div>
<div class="column-two-thirds">
<h1 class="heading-large">
GOV.UK Notify data sharing and financial agreement
</h1>
{% include 'views/agreement/_agreement.html'%}
</div>
</div>
{% endblock %}

View File

@@ -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 %}
<div class="grid-row">
<div class="column-five-sixths">
{{ 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'%}
</div>
</div>
{% endblock %}

View File

@@ -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 %}
<div class="grid-row">
<div class="column-five-sixths">
{{ 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' %}
</div>
</div>
{% endblock %}

View File

@@ -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 %}
<div class="grid-row">
<div class="column-five-sixths">
{{ 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'%}
</div>
</div>
{% endblock %}

View File

@@ -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 %}

View File

@@ -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]()