Add details of MOU signatory to go live ticket

This will help us monitor organisations that have signed our MOU using a
shared inbox and prevent it happening in future.

https://www.pivotaltracker.com/story/show/179782040
This commit is contained in:
Chris Hill-Scott
2021-10-11 14:58:28 +01:00
parent fad3ff70f2
commit ec703c5998
4 changed files with 75 additions and 1 deletions

View File

@@ -204,6 +204,12 @@ class Organisation(JSONModel):
self.letter_branding_id self.letter_branding_id
) )
@cached_property
def agreement_signed_by(self):
if self.agreement_signed_by_id:
from app.models.user import User
return User.from_id(self.agreement_signed_by_id)
def update(self, delete_services_cache=False, **kwargs): def update(self, delete_services_cache=False, **kwargs):
response = organisations_client.update_organisation( response = organisations_client.update_organisation(
self.id, self.id,

View File

@@ -4,6 +4,12 @@ Service: {{ current_service.name }}
--- ---
Organisation type: {{ current_service.organisation_type_label }} Organisation type: {{ current_service.organisation_type_label }}
Agreement signed: {{ current_service.organisation.as_agreement_statement_for_go_live_request(current_user.email_domain) }} Agreement signed: {{ current_service.organisation.as_agreement_statement_for_go_live_request(current_user.email_domain) }}
{%- if current_service.organisation.agreement_signed_by %}
Agreement signed by: {{ current_service.organisation.agreement_signed_by.email_address }}
{% endif -%}
{%- if current_service.organisation.agreement_signed_on_behalf_of_email_address -%}
Agreement signed on behalf of: {{ current_service.organisation.agreement_signed_on_behalf_of_email_address }}
{%- endif %}
Emails in next year: {{ current_service.volume_email|format_thousands }} Emails in next year: {{ current_service.volume_email|format_thousands }}
Text messages in next year: {{ current_service.volume_sms|format_thousands }} Text messages in next year: {{ current_service.volume_sms|format_thousands }}

View File

@@ -218,6 +218,7 @@ def organisation_json(
crown=True, crown=True,
agreement_signed=False, agreement_signed=False,
agreement_signed_version=None, agreement_signed_version=None,
agreement_signed_by_id=None,
agreement_signed_on_behalf_of_name=None, agreement_signed_on_behalf_of_name=None,
agreement_signed_on_behalf_of_email_address=None, agreement_signed_on_behalf_of_email_address=None,
organisation_type='central', organisation_type='central',
@@ -244,7 +245,7 @@ def organisation_json(
'crown': crown, 'crown': crown,
'agreement_signed': agreement_signed, 'agreement_signed': agreement_signed,
'agreement_signed_at': None, 'agreement_signed_at': None,
'agreement_signed_by': None, 'agreement_signed_by_id': agreement_signed_by_id,
'agreement_signed_version': agreement_signed_version, 'agreement_signed_version': agreement_signed_version,
'agreement_signed_on_behalf_of_name': agreement_signed_on_behalf_of_name, 'agreement_signed_on_behalf_of_name': agreement_signed_on_behalf_of_name,
'agreement_signed_on_behalf_of_email_address': agreement_signed_on_behalf_of_email_address, 'agreement_signed_on_behalf_of_email_address': agreement_signed_on_behalf_of_email_address,

View File

@@ -1853,6 +1853,67 @@ def test_request_to_go_live_displays_go_live_notes_in_zendesk_ticket(
mock_send_ticket_to_zendesk.assert_called_once() mock_send_ticket_to_zendesk.assert_called_once()
def test_request_to_go_live_displays_mou_signatories(
client_request,
mocker,
fake_uuid,
active_user_with_permissions,
single_reply_to_email_address,
single_letter_contact_block,
mock_get_organisations_and_services_for_user,
single_sms_sender,
mock_get_service_organisation,
mock_get_service_settings_page_common,
mock_get_service_templates,
mock_get_users_by_service,
mock_update_service,
mock_get_invites_without_manage_permission,
):
mocker.patch(
'app.organisations_client.get_organisation',
side_effect=lambda org_id: organisation_json(
ORGANISATION_ID,
'Org 1',
agreement_signed=True,
agreement_signed_by_id=fake_uuid,
agreement_signed_on_behalf_of_email_address='bigdog@example.gov.uk',
)
)
mocker.patch(
'app.main.views.service_settings.zendesk_client.send_ticket_to_zendesk',
autospec=True,
)
mock_create_ticket = mocker.spy(NotifySupportTicket, '__init__')
client_request.post(
'main.request_to_go_live',
service_id=SERVICE_ONE_ID,
_follow_redirects=True
)
assert mock_create_ticket.call_args[1]['message'] == (
'Service: service one\n'
f'http://localhost/services/{SERVICE_ONE_ID}\n'
'\n'
'---\n'
'Organisation type: Central government\n'
'Agreement signed: Yes, on behalf of Org 1.\n'
'Agreement signed by: test@user.gov.uk\n'
'Agreement signed on behalf of: bigdog@example.gov.uk\n'
'\n'
'Emails in next year: 111,111\n'
'Text messages in next year: 222,222\n'
'Letters in next year: 333,333\n'
'\n'
'Consent to research: Yes\n'
'Other live services for that user: No\n'
'\n'
'Service reply-to address: test@example.com\n'
'\n'
'---\n'
'Request sent by test@user.gov.uk\n'
)
def test_should_be_able_to_request_to_go_live_with_no_organisation( def test_should_be_able_to_request_to_go_live_with_no_organisation(
client_request, client_request,
mocker, mocker,