mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 01:08:25 -04:00
Add info about checklist to ticket
So that someone picking up a ticket can be warned that they should be checking these things.
This commit is contained in:
@@ -199,6 +199,7 @@ def submit_request_to_go_live(service_id):
|
||||
'\n---'
|
||||
'\nOrganisation type: {organisation_type}'
|
||||
'\nAgreement signed: {agreement}'
|
||||
'\nChecklist completed: {checklist}'
|
||||
'\nEmails in next year: {volume_email}'
|
||||
'\nText messages in next year: {volume_sms}'
|
||||
'\nLetters in next year: {volume_letter}'
|
||||
@@ -221,6 +222,7 @@ def submit_request_to_go_live(service_id):
|
||||
service_dashboard=url_for('main.service_dashboard', service_id=current_service.id, _external=True),
|
||||
organisation_type=str(current_service.organisation_type).title(),
|
||||
agreement=AgreementInfo.from_current_user().as_human_readable,
|
||||
checklist='Yes' if current_service.go_live_checklist_completed else 'No',
|
||||
volume_email=form.volume_email.data,
|
||||
volume_sms=form.volume_sms.data,
|
||||
volume_letter=form.volume_letter.data,
|
||||
|
||||
@@ -355,3 +355,23 @@ class Service(dict):
|
||||
return get_default_sms_sender(
|
||||
service_api_client.get_sms_senders(self.id)
|
||||
) in {'GOVUK', 'None'}
|
||||
|
||||
@property
|
||||
def go_live_checklist_completed(self):
|
||||
return all((
|
||||
self.has_team_members,
|
||||
self.has_templates,
|
||||
any((
|
||||
not self.has_email_templates,
|
||||
self.has_email_reply_to_address,
|
||||
)),
|
||||
any((
|
||||
not self.has_sms_templates,
|
||||
not self.shouldnt_use_govuk_as_sms_sender,
|
||||
not self.sms_sender_is_govuk,
|
||||
))
|
||||
))
|
||||
|
||||
@property
|
||||
def go_live_checklist_completed_as_yes_no(self):
|
||||
return 'Yes' if self.go_live_checklist_completed else 'No'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import uuid
|
||||
from functools import partial
|
||||
from unittest.mock import ANY, call
|
||||
from unittest.mock import ANY, PropertyMock, call
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
import pytest
|
||||
@@ -737,7 +737,9 @@ def test_should_redirect_after_request_to_go_live(
|
||||
single_letter_contact_block,
|
||||
mock_get_service_organisation,
|
||||
single_sms_sender,
|
||||
mock_get_service_settings_page_common
|
||||
mock_get_service_settings_page_common,
|
||||
mock_get_service_templates,
|
||||
mock_get_users_by_service,
|
||||
):
|
||||
mock_post = mocker.patch('app.main.views.service_settings.zendesk_client.create_ticket', autospec=True)
|
||||
page = client_request.post(
|
||||
@@ -765,6 +767,7 @@ def test_should_redirect_after_request_to_go_live(
|
||||
'---\n'
|
||||
'Organisation type: Central\n'
|
||||
'Agreement signed: Can’t tell (domain is user.gov.uk)\n'
|
||||
'Checklist completed: No\n'
|
||||
'Emails in next year: 111\n'
|
||||
'Text messages in next year: 222\n'
|
||||
'Letters in next year: 333\n'
|
||||
@@ -782,6 +785,111 @@ def test_should_redirect_after_request_to_go_live(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
(
|
||||
'has_team_members,'
|
||||
'has_templates,'
|
||||
'has_email_templates,'
|
||||
'has_sms_templates,'
|
||||
'has_email_reply_to_address,'
|
||||
'shouldnt_use_govuk_as_sms_sender,'
|
||||
'sms_sender_is_govuk,'
|
||||
'expected,'
|
||||
),
|
||||
(
|
||||
( # Just sending email
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
'Yes',
|
||||
),
|
||||
( # Needs to set reply to address
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
'No',
|
||||
),
|
||||
( # Just sending SMS
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
'Yes',
|
||||
),
|
||||
( # Needs to change SMS sender
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
'No',
|
||||
),
|
||||
( # Needs team members
|
||||
False,
|
||||
True,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
'No',
|
||||
),
|
||||
( # Needs templates
|
||||
True,
|
||||
False,
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
'No',
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_ready_to_go_live(
|
||||
client_request,
|
||||
mocker,
|
||||
has_team_members,
|
||||
has_templates,
|
||||
has_email_templates,
|
||||
has_sms_templates,
|
||||
has_email_reply_to_address,
|
||||
shouldnt_use_govuk_as_sms_sender,
|
||||
sms_sender_is_govuk,
|
||||
expected,
|
||||
):
|
||||
for prop in {
|
||||
'has_team_members',
|
||||
'has_templates',
|
||||
'has_email_templates',
|
||||
'has_sms_templates',
|
||||
'has_email_reply_to_address',
|
||||
'shouldnt_use_govuk_as_sms_sender',
|
||||
'sms_sender_is_govuk',
|
||||
}:
|
||||
mocker.patch(
|
||||
'app.notify_client.models.Service.{}'.format(prop),
|
||||
new_callable=PropertyMock
|
||||
).return_value = locals()[prop]
|
||||
|
||||
assert app.notify_client.models.Service({
|
||||
'id': fake_uuid()
|
||||
}).go_live_checklist_completed_as_yes_no == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize('route', [
|
||||
'main.service_settings',
|
||||
'main.service_name_change',
|
||||
|
||||
Reference in New Issue
Block a user