Let people choose which agreement to download

If we don’t know whether people belong to a crown organisation we should
give them the option of self-selecting, because they might themselves
know.

This commit adds a new version of the ‘agreement’ page which gives
people exactly that choice. It doesn’t link to it yet.
This commit is contained in:
Chris Hill-Scott
2018-05-08 14:21:52 +01:00
parent e19e68396f
commit 947b67ee1a
3 changed files with 96 additions and 10 deletions

View File

@@ -13,7 +13,12 @@ def agreement():
agreement_info = AgreementInfo.from_current_user()
agreement_info.crown_status_or_404
if agreement_info.crown_status is None:
return render_template(
'views/agreement-choose.html',
owner=agreement_info.owner,
navigation_links=features_nav(),
)
return render_template(
'views/agreement.html',

View File

@@ -0,0 +1,59 @@
{% extends "withoutnav_template.html" %}
{% from "components/sub-navigation.html" import sub_navigation %}
{% block per_page_title %}
Download the 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">
Download the 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>
Unsure whether your organisation is a crown body? Contact
<a href="{{ url_for('main.support') }}">support</a>
and well help you work it out.
</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,3 +1,4 @@
from functools import partial
from io import BytesIO
import pytest
@@ -15,25 +16,46 @@ class _MockS3Object():
return {'Body': BytesIO(self.data)}
@pytest.mark.parametrize('email_address, expected_status', [
('test@cabinet-office.gov.uk', 200),
('test@aylesburytowncouncil.gov.uk', 200),
('test@unknown.gov.uk', 404),
@pytest.mark.parametrize('email_address, expected_links', [
(
'test@cabinet-office.gov.uk',
[
partial(url_for, 'main.download_agreement'),
lambda: 'mailto:notify-support@digital.cabinet-office.gov.uk',
]
),
(
'test@aylesburytowncouncil.gov.uk',
[
partial(url_for, 'main.download_agreement'),
lambda: 'mailto:notify-support@digital.cabinet-office.gov.uk',
]
),
(
'test@unknown.gov.uk',
[
partial(url_for, 'main.public_download_agreement', variant='crown'),
partial(url_for, 'main.public_download_agreement', variant='non-crown'),
partial(url_for, 'main.support'),
lambda: 'mailto:notify-support@digital.cabinet-office.gov.uk',
]
),
])
def test_show_agreement_page(
client_request,
mocker,
fake_uuid,
email_address,
expected_status,
expected_links,
):
user = active_user_with_permissions(fake_uuid)
user.email_address = email_address
mocker.patch('app.user_api_client.get_user', return_value=user)
client_request.get(
'main.agreement',
_expected_status=expected_status,
)
page = client_request.get('main.agreement')
links = page.select('main .column-two-thirds a')
assert len(links) == len(expected_links)
for index, link in enumerate(links):
assert link['href'] == expected_links[index]()
@pytest.mark.parametrize('email_address, expected_file_fetched, expected_file_served', [