mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 13:41:38 -04:00
Look in organisation for whitelisted domains
At the moment we have to update a YAML file and deploy the change to get a new domain whitelisted. We already have a thing for adding new domains – the organisation stuff. This commit extends the validation to look in the `domains` table on the API if it can’t find anything in the YAML whitelist. This has the advantage of: - not having to deploy code to whitelist a new domain - forcing us to create new organisations as they come along, so that users’ services automatically get allocated to the organisation once their domain is whitelisted
This commit is contained in:
@@ -30,7 +30,8 @@ def test_should_raise_validation_error_for_password(
|
||||
|
||||
|
||||
def test_valid_email_not_in_valid_domains(
|
||||
client
|
||||
client,
|
||||
mock_get_organisations,
|
||||
):
|
||||
form = RegisterUserForm(email_address="test@test.com", mobile_number='441231231231')
|
||||
assert not form.validate()
|
||||
@@ -50,7 +51,8 @@ def test_valid_email_in_valid_domains(
|
||||
|
||||
|
||||
def test_invalid_email_address_error_message(
|
||||
client
|
||||
client,
|
||||
mock_get_organisations,
|
||||
):
|
||||
form = RegisterUserForm(
|
||||
name="test",
|
||||
@@ -149,6 +151,7 @@ def test_valid_list_of_white_list_email_domains(
|
||||
def test_invalid_list_of_white_list_email_domains(
|
||||
client,
|
||||
email,
|
||||
mock_get_organisations,
|
||||
):
|
||||
email_domain_validators = ValidGovEmail()
|
||||
with pytest.raises(ValidationError):
|
||||
|
||||
Reference in New Issue
Block a user