Pass admin URL to API for registration email

This follows the pattern for invite emails where the admin app tells the
API which domain to use when generating the link.
This commit is contained in:
Chris Hill-Scott
2022-03-07 15:11:50 +00:00
parent 39856f70d1
commit 50015c3125
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',
},
)