From 5e1eac1f6f232ff7a3092defb2daa3fecaf86cb8 Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Thu, 14 Dec 2017 17:05:36 +0000 Subject: [PATCH 1/2] Add test for manifest-delivery-base.yml - This should ensure that queue names defined in config.py / QueueNames are in the manifest-delivery-base.yml --- tests/test_manifest_delivery_base.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_manifest_delivery_base.py diff --git a/tests/test_manifest_delivery_base.py b/tests/test_manifest_delivery_base.py new file mode 100644 index 000000000..265a1170b --- /dev/null +++ b/tests/test_manifest_delivery_base.py @@ -0,0 +1,23 @@ +import yaml + +from app.config import QueueNames + + +def test_queue_names_set_in_manifest_delivery_base_correctly(): + with open("manifest-delivery-base.yml", 'r') as stream: + search = ' -Q ' + yml_commands = [y['command'] for y in yaml.load(stream)['applications']] + + watched_queues = set() + for command in yml_commands: + start_of_queue_arg = command.find(search) + if start_of_queue_arg > 0: + start_of_queue_names = start_of_queue_arg + len(search) + queues = command[start_of_queue_names:].split(',') + watched_queues.update(queues) + + # ses-callbacks isn't used in api (only used in SNS lambda) + ignored_queues = {'ses-callbacks'} + watched_queues -= ignored_queues + + assert watched_queues == set(QueueNames.all_queues()) From 1b82afb6bbdacec152d33ae2e7000475b39e4293 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 18 Dec 2017 11:39:21 +0000 Subject: [PATCH 2/2] Change reply to address for invitation emails to be invitation sender If someone receives an invitation email for Notify the reply-to address of the email was the GOV.UK Notify email address. This has been changed to be the email address of the user who sent the invite. Pivotal story: https://www.pivotaltracker.com/story/show/153094646 --- app/invite/rest.py | 2 +- tests/app/invite/test_invite_rest.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/invite/rest.py b/app/invite/rest.py index 55cab2a30..ba263e1b3 100644 --- a/app/invite/rest.py +++ b/app/invite/rest.py @@ -42,7 +42,7 @@ def create_invited_user(service_id): notification_type=EMAIL_TYPE, api_key_id=None, key_type=KEY_TYPE_NORMAL, - reply_to_text=service.get_default_reply_to_email_address() + reply_to_text=invited_user.from_user.email_address ) send_notification_to_queue(saved_notification, False, queue=QueueNames.NOTIFY) diff --git a/tests/app/invite/test_invite_rest.py b/tests/app/invite/test_invite_rest.py index 1c4c6b10a..ebeeb3492 100644 --- a/tests/app/invite/test_invite_rest.py +++ b/tests/app/invite/test_invite_rest.py @@ -33,7 +33,7 @@ def test_create_invited_user(admin_request, sample_service, mocker, invitation_e assert json_resp['data']['id'] notification = Notification.query.first() - assert notification.reply_to_text == "notify@gov.uk" + assert notification.reply_to_text == invite_from.email_address mocked.assert_called_once_with([(str(notification.id))], queue="notify-internal-tasks")