From 793842bb3b9926f8eae1150e1624ebd70f9ca858 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 28 Mar 2018 13:52:41 +0100 Subject: [PATCH] Let users download the crown agreement This (partially) reverts commit dca5546cbd0ce490a00bc52841b24bfa109a3173 Depends on - [ ] agreement being uploaded to the bucket in all environments as `crown.pdf` --- app/utils.py | 4 ++-- tests/app/main/views/test_agreement.py | 6 +++--- tests/app/main/views/test_index.py | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/utils.py b/app/utils.py index ddf023f86..13a0aec44 100644 --- a/app/utils.py +++ b/app/utils.py @@ -484,7 +484,7 @@ class AgreementInfo: 'agreement.'.format(self.owner) ) - if self.crown_status is False: + if self.crown_status is not None: return (( '{} Download a copy.' ).format(self._acceptance_required, download_link)) @@ -504,7 +504,7 @@ class AgreementInfo: @property def crown_status_or_404(self): - if self.crown_status in {None, True}: + if self.crown_status is None: abort(404) return self.crown_status diff --git a/tests/app/main/views/test_agreement.py b/tests/app/main/views/test_agreement.py index a033a4b5b..d84b556aa 100644 --- a/tests/app/main/views/test_agreement.py +++ b/tests/app/main/views/test_agreement.py @@ -16,7 +16,7 @@ class _MockS3Object(): @pytest.mark.parametrize('email_address, expected_status', [ - ('test@cabinet-office.gov.uk', 404), + ('test@cabinet-office.gov.uk', 200), ('test@aylesburytowncouncil.gov.uk', 200), ('test@unknown.gov.uk', 404), ]) @@ -37,11 +37,11 @@ def test_show_agreement_page( @pytest.mark.parametrize('email_address, expected_file_fetched, expected_file_served', [ - pytest.mark.xfail(( + ( 'test@cabinet-office.gov.uk', 'crown.pdf', 'GOV.UK Notify data sharing and financial agreement.pdf', - ), raises=AssertionError), + ), ( 'test@aylesburytowncouncil.gov.uk', 'non-crown.pdf', diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index e010ccede..fc4fe1bd4 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -160,13 +160,11 @@ def test_terms_is_generic_if_user_is_not_logged_in( 'michael.fish@metoffice.gov.uk', ( 'Your organisation (Met Office) must also accept our data ' - 'sharing and financial agreement. Contact us to get a copy.' + 'sharing and financial agreement. Download a copy.' ), partial( url_for, - 'main.feedback', - ticket_type='ask-question-give-feedback', - body='agreement-with-owner', + 'main.agreement', ), ( 'Contact us to get a copy of the agreement (Met Office '