Merge pull request #4186 from alphagov/tell-admin-app-base-url-for-registration-email

Pass admin URL to API for registration email
This commit is contained in:
Chris Hill-Scott
2022-03-07 16:09:18 +00:00
committed by GitHub
2 changed files with 23 additions and 1 deletions

View File

@@ -101,7 +101,10 @@ class UserApiClient(NotifyAdminAPIClient):
self.post(endpoint, data=data)
def send_verify_email(self, user_id, to):
data = {'to': to}
data = {
'to': to,
'admin_base_url': self.admin_url,
}
endpoint = '/user/{0}/email-verification'.format(user_id)
self.post(endpoint, data=data)

View File

@@ -325,3 +325,22 @@ def test_reset_password(
'admin_base_url': 'http://localhost:6012',
},
)
def test_send_registration_email(
mocker,
fake_uuid,
):
mock_post = mocker.patch(
'app.notify_client.user_api_client.UserApiClient.post'
)
user_api_client.send_verify_email(fake_uuid, 'test@example.com')
mock_post.assert_called_once_with(
f'/user/{fake_uuid}/email-verification',
data={
'to': 'test@example.com',
'admin_base_url': 'http://localhost:6012',
},
)