mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
If a user has already registered with the email they will get a different email when the register again.
The email includes likes to sign in and send feedback
This commit is contained in:
@@ -123,9 +123,10 @@ def test_should_return_200_if_password_is_blacklisted(app_,
|
||||
assert 'That password is blacklisted, too common' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_register_with_existing_email_returns_error(app_,
|
||||
api_user_active,
|
||||
mock_get_user_by_email):
|
||||
def test_register_with_existing_email_sends_emails(app_,
|
||||
api_user_active,
|
||||
mock_get_user_by_email,
|
||||
mock_send_already_registered_email):
|
||||
user_data = {
|
||||
'name': 'Already Hasaccount',
|
||||
'email_address': api_user_active.email_address,
|
||||
@@ -136,9 +137,5 @@ def test_register_with_existing_email_returns_error(app_,
|
||||
with app_.test_request_context():
|
||||
response = app_.test_client().post(url_for('main.register'),
|
||||
data=user_data)
|
||||
assert response.status_code == 400
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
element = page.find('h1')
|
||||
assert element.text == 'Create an account'
|
||||
flash_banner = page.find('div', class_='banner-dangerous').string.strip()
|
||||
assert flash_banner == 'There was an error registering your account'
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('main.registration_continue', _external=True)
|
||||
|
||||
@@ -1121,3 +1121,8 @@ def mock_events(mocker):
|
||||
return {'some': 'data'}
|
||||
|
||||
return mocker.patch('app.events_api_client.create_event', side_effect=_create_event)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_send_already_registered_email(mocker):
|
||||
return mocker.patch('app.user_api_client.send_already_registered_email')
|
||||
|
||||
Reference in New Issue
Block a user