Allow custom notes when service goes live

This adds an option on the organisation settings page to add
'request_to_go_live_notes'. When a service belonging to this
organisation requests to go live, any go live notes for the
organisation will be added to the Zendesk ticket in the 'Agreement
signed' section.
This commit is contained in:
Katie Smith
2019-05-13 14:50:40 +01:00
parent e4b1759b3b
commit da971b2da7
9 changed files with 186 additions and 6 deletions

View File

@@ -503,6 +503,7 @@ def test_organisation_settings_for_platform_admin(
'Organisation type Not set Change',
'Crown organisation Yes Change',
'Data sharing and financial agreement Not signed Change',
'Request to go live notes None Change',
'Default email branding GOV.UK Change',
'Default letter branding No branding Change',
'Known email domains None Change',
@@ -945,3 +946,53 @@ def test_confirm_update_organisation_with_name_already_in_use(
assert response.status_code == 302
assert response.location == url_for('main.edit_organisation_name', org_id=organisation_one['id'], _external=True)
def test_get_edit_organisation_go_live_notes_page(
logged_in_platform_admin_client,
mock_get_organisation,
organisation_one,
):
response = logged_in_platform_admin_client.get(
url_for(
'.edit_organisation_go_live_notes',
org_id=organisation_one['id']
)
)
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.find('textarea', id='request_to_go_live_notes')
@pytest.mark.parametrize('input_note,saved_note', [
('Needs permission', 'Needs permission'),
(' ', None)
])
def test_post_edit_organisation_go_live_notes_updates_go_live_notes(
logged_in_platform_admin_client,
mock_get_organisation,
mock_update_organisation,
organisation_one,
input_note,
saved_note,
):
response = logged_in_platform_admin_client.post(
url_for(
'.edit_organisation_go_live_notes',
org_id=organisation_one['id'],
),
data={'request_to_go_live_notes': input_note}
)
mock_update_organisation.assert_called_once_with(
organisation_one['id'],
request_to_go_live_notes=saved_note
)
assert response.status_code == 302
assert response.location == url_for(
'.organisation_settings',
org_id=organisation_one['id'],
_external=True
)

View File

@@ -1380,7 +1380,7 @@ def test_should_redirect_after_request_to_go_live(
'\n'
'---\n'
'Organisation type: Central\n'
'Agreement signed: Cant tell (domain is user.gov.uk)\n'
'Agreement signed: Cant tell (domain is user.gov.uk).\n'
'{formatted_displayed_volumes}'
'Consent to research: Yes\n'
'Other live services: No\n'
@@ -1405,6 +1405,58 @@ def test_should_redirect_after_request_to_go_live(
)
def test_request_to_go_live_displays_go_live_notes_in_zendesk_ticket(
client_request,
mocker,
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_settings_page_common,
mock_get_service_templates,
mock_get_users_by_service,
mock_update_service,
mock_get_invites_without_manage_permission,
):
go_live_note = 'This service is not allowed to go live'
mocker.patch(
'app.organisations_client.get_service_organisation',
side_effect=lambda org_id: organisation_json(
ORGANISATION_ID,
'Org 1',
request_to_go_live_notes=go_live_note,
)
)
mock_post = mocker.patch('app.main.views.service_settings.zendesk_client.create_ticket', autospec=True)
client_request.post(
'main.request_to_go_live',
service_id=SERVICE_ONE_ID,
_follow_redirects=True
)
assert mock_post.call_args[1]['message'] == (
'Service: service one\n'
'http://localhost/services/{service_id}\n'
'\n'
'---\n'
'Organisation type: Central\n'
'Agreement signed: No (organisation is Org 1, a crown body). {go_live_note}\n'
'Emails in next year: 111,111\n'
'Text messages in next year: 222,222\n'
'Letters in next year: 333,333\n'
'Consent to research: Yes\n'
'Other live services: No\n'
'\n'
'---\n'
'Request sent by test@user.gov.uk\n'
).format(
service_id=SERVICE_ONE_ID,
go_live_note=go_live_note
)
def test_should_be_able_to_request_to_go_live_with_no_organisation(
client_request,
mocker,