mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Let the Notify team invite people to an organisation
We want to start granting access to the org page. But it will be a bit weird if the invites come from us personally, since the people we’re inviting don’t know us. It makes more sense, and sounds more official if the invites appear to come from the ‘GOV.UK Notify team’ instead.
This commit is contained in:
@@ -5,6 +5,10 @@ from app.models import Notification, INVITE_PENDING
|
||||
from tests.app.db import create_invited_org_user
|
||||
|
||||
|
||||
@pytest.mark.parametrize('platform_admin, expected_invited_by', (
|
||||
(True, 'The GOV.UK Notify team'),
|
||||
(False, 'Test User')
|
||||
))
|
||||
@pytest.mark.parametrize('extra_args, expected_start_of_invite_url', [
|
||||
(
|
||||
{},
|
||||
@@ -23,9 +27,12 @@ def test_create_invited_org_user(
|
||||
org_invite_email_template,
|
||||
extra_args,
|
||||
expected_start_of_invite_url,
|
||||
platform_admin,
|
||||
expected_invited_by,
|
||||
):
|
||||
mocked = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
|
||||
email_address = 'invited_user@example.com'
|
||||
sample_user.platform_admin = platform_admin
|
||||
|
||||
data = dict(
|
||||
organisation=str(sample_organisation.id),
|
||||
@@ -53,7 +60,7 @@ def test_create_invited_org_user(
|
||||
|
||||
assert len(notification.personalisation.keys()) == 3
|
||||
assert notification.personalisation['organisation_name'] == 'sample organisation'
|
||||
assert notification.personalisation['user_name'] == 'Test User'
|
||||
assert notification.personalisation['user_name'] == expected_invited_by
|
||||
assert notification.personalisation['url'].startswith(expected_start_of_invite_url)
|
||||
assert len(notification.personalisation['url']) > len(expected_start_of_invite_url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user