From ec6c2c6d1de014a99e838e08717f05db11f8c57e Mon Sep 17 00:00:00 2001 From: Adrian Turjak Date: Tue, 26 Oct 2021 16:10:58 +1300 Subject: [PATCH] Fix some issues with updating user email defaults Change-Id: I8d33f0b0f13eba64569a17836bb2ca5ffb9f1c93 --- adjutant/api/v1/tests/test_api_taskview.py | 3 ++- adjutant/tasks/v1/users.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/adjutant/api/v1/tests/test_api_taskview.py b/adjutant/api/v1/tests/test_api_taskview.py index 3ecb0e0..f24c1dd 100644 --- a/adjutant/api/v1/tests/test_api_taskview.py +++ b/adjutant/api/v1/tests/test_api_taskview.py @@ -967,7 +967,7 @@ class DelegateAPITests(AdjutantAPITestCase): self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) self.assertEqual(response.json(), {"notes": ["task created"]}) - self.assertEqual(len(mail.outbox), 1) + self.assertEqual(len(mail.outbox), 2) new_token = Token.objects.all()[0] url = "/v1/tokens/" + new_token.token @@ -976,6 +976,7 @@ class DelegateAPITests(AdjutantAPITestCase): response = self.client.post(url, data, format="json") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(user.email, "new_test@example.com") + self.assertEqual(len(mail.outbox), 3) def test_update_email_task_not_authenticated(self): """ diff --git a/adjutant/tasks/v1/users.py b/adjutant/tasks/v1/users.py index 4067448..ab3eae5 100644 --- a/adjutant/tasks/v1/users.py +++ b/adjutant/tasks/v1/users.py @@ -77,7 +77,7 @@ class UpdateUserEmail(BaseTask): ] action_config = { "SendAdditionalEmailAction": { - "initial": { + "prepare": { "subject": "OpenStack Email Update Requested", "template": "update_user_email_started.txt", "email_current_user": True,