mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
Valid email domains added and tests passing.
This commit is contained in:
@@ -6,8 +6,43 @@ def test_should_raise_validation_error_for_password(app_, mock_get_user_by_email
|
||||
form = RegisterUserForm()
|
||||
form.name.data = 'test'
|
||||
form.email_address.data = 'teset@example.gov.uk'
|
||||
form.mobile_number.data = '+441231231231'
|
||||
form.mobile_number.data = '441231231231'
|
||||
form.password.data = 'password1234'
|
||||
|
||||
form.validate()
|
||||
assert 'That password is blacklisted, too common' in form.errors['password']
|
||||
|
||||
|
||||
def test_valid_email_not_in_valid_domains(app_):
|
||||
with app_.test_request_context():
|
||||
form = RegisterUserForm(email_address="test@test.com", mobile_number='441231231231')
|
||||
assert not form.validate()
|
||||
assert "Enter a central government email address" in form.errors['email_address'][0]
|
||||
|
||||
|
||||
def test_valid_email_in_valid_domains(app_):
|
||||
with app_.test_request_context():
|
||||
form = RegisterUserForm(
|
||||
name="test",
|
||||
email_address="test@my.gov.uk",
|
||||
mobile_number='4407888999111',
|
||||
password='1234567890')
|
||||
form.validate()
|
||||
assert form.errors == {}
|
||||
|
||||
|
||||
def test_invalid_email_address_error_message(app_):
|
||||
with app_.test_request_context():
|
||||
form = RegisterUserForm(
|
||||
name="test",
|
||||
email_address="test.com",
|
||||
mobile_number='4407888999111',
|
||||
password='1234567890')
|
||||
assert not form.validate()
|
||||
|
||||
form = RegisterUserForm(
|
||||
name="test",
|
||||
email_address="test.com",
|
||||
mobile_number='4407888999111',
|
||||
password='1234567890')
|
||||
assert not form.validate()
|
||||
|
||||
@@ -71,7 +71,8 @@ def test_should_return_400_when_email_is_not_gov_uk(app_,
|
||||
'password': 'validPassword!'})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'Enter a gov.uk email address' in response.get_data(as_text=True)
|
||||
print(response.get_data(as_text=True))
|
||||
assert 'Enter a central government email address' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_should_add_verify_codes_on_session(app_,
|
||||
|
||||
Reference in New Issue
Block a user