From c59e0091eeb4c51a93cc8c2189d87b659aef7566 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Tue, 16 Feb 2021 13:23:05 +0000 Subject: [PATCH 1/2] Stop emailing Notify when an MOU is signed We've decided we don't get any value from these emails any more, so this stops us (Notify support) receiving them. We still let teams know an MOU has been signed. --- app/config.py | 1 - app/organisation/rest.py | 7 ------- tests/app/conftest.py | 1 - tests/app/organisation/test_rest.py | 2 -- 4 files changed, 11 deletions(-) diff --git a/app/config.py b/app/config.py index f3de3baaf..37c4602da 100644 --- a/app/config.py +++ b/app/config.py @@ -178,7 +178,6 @@ class Config(object): MOU_SIGNER_RECEIPT_TEMPLATE_ID = '4fd2e43c-309b-4e50-8fb8-1955852d9d71' MOU_SIGNED_ON_BEHALF_SIGNER_RECEIPT_TEMPLATE_ID = 'c20206d5-bf03-4002-9a90-37d5032d9e84' MOU_SIGNED_ON_BEHALF_ON_BEHALF_RECEIPT_TEMPLATE_ID = '522b6657-5ca5-4368-a294-6b527703bd0b' - MOU_NOTIFY_TEAM_ALERT_TEMPLATE_ID = 'd0e66c4c-0c50-43f0-94f5-f85b613202d4' NOTIFY_INTERNATIONAL_SMS_SENDER = '07984404008' BROKER_URL = 'sqs://' diff --git a/app/organisation/rest.py b/app/organisation/rest.py index f544be041..9c7c9f4a5 100644 --- a/app/organisation/rest.py +++ b/app/organisation/rest.py @@ -208,13 +208,6 @@ def send_notifications_on_mou_signed(organisation_id): 'on_behalf_of_name': organisation.agreement_signed_on_behalf_of_name } - # let notify team know something's happened - _send_notification( - current_app.config['MOU_NOTIFY_TEAM_ALERT_TEMPLATE_ID'], - 'notify-support+{}@digital.cabinet-office.gov.uk'.format(current_app.config['NOTIFY_ENVIRONMENT']), - personalisation - ) - if not organisation.agreement_signed_on_behalf_of_email_address: signer_template_id = 'MOU_SIGNER_RECEIPT_TEMPLATE_ID' else: diff --git a/tests/app/conftest.py b/tests/app/conftest.py index ce91c2e5a..4099d65af 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -795,7 +795,6 @@ def mou_signed_templates(notify_db, notify_db_session): 'MOU_SIGNER_RECEIPT_TEMPLATE_ID', 'MOU_SIGNED_ON_BEHALF_SIGNER_RECEIPT_TEMPLATE_ID', 'MOU_SIGNED_ON_BEHALF_ON_BEHALF_RECEIPT_TEMPLATE_ID', - 'MOU_NOTIFY_TEAM_ALERT_TEMPLATE_ID', ] } diff --git a/tests/app/organisation/test_rest.py b/tests/app/organisation/test_rest.py index 2fb52d338..94a2e73eb 100644 --- a/tests/app/organisation/test_rest.py +++ b/tests/app/organisation/test_rest.py @@ -442,7 +442,6 @@ def test_post_update_organisation_set_mou_doesnt_email_if_no_signed_by( None, None, { - 'MOU_NOTIFY_TEAM_ALERT_TEMPLATE_ID': 'notify-support+test@digital.cabinet-office.gov.uk', 'MOU_SIGNER_RECEIPT_TEMPLATE_ID': 'notify@digital.cabinet-office.gov.uk', } ), @@ -450,7 +449,6 @@ def test_post_update_organisation_set_mou_doesnt_email_if_no_signed_by( 'Important Person', 'important@person.com', { - 'MOU_NOTIFY_TEAM_ALERT_TEMPLATE_ID': 'notify-support+test@digital.cabinet-office.gov.uk', 'MOU_SIGNED_ON_BEHALF_ON_BEHALF_RECEIPT_TEMPLATE_ID': 'important@person.com', 'MOU_SIGNED_ON_BEHALF_SIGNER_RECEIPT_TEMPLATE_ID': 'notify@digital.cabinet-office.gov.uk', } From c77e73b26f5b7633dd12c1ad5db0529101302f35 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Tue, 16 Feb 2021 13:50:07 +0000 Subject: [PATCH 2/2] Fix failing test This was passing locally, but failing on Concourse due to a different order of TemplateHistory items being returned. This changes the test so that it can't randomly fail based on the order of template history items returned. --- tests/app/template/test_rest.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/app/template/test_rest.py b/tests/app/template/test_rest.py index 36a1ddd8d..9096ed95d 100644 --- a/tests/app/template/test_rest.py +++ b/tests/app/template/test_rest.py @@ -377,12 +377,10 @@ def test_update_should_update_a_template(client, sample_user): assert update_json_resp['data']['version'] == 2 assert update_json_resp['data']['created_by'] == str(sample_user.id) - assert [ - template.created_by_id for template in TemplateHistory.query.all() - ] == [ - service.created_by.id, - sample_user.id, - ] + template_created_by_users = [template.created_by_id for template in TemplateHistory.query.all()] + assert len(template_created_by_users) == 2 + assert service.created_by.id in template_created_by_users + assert sample_user.id in template_created_by_users def test_should_be_able_to_archive_template(client, sample_template):