Fixed bug where there was an error when try and change email.

- it tried to send a verify code which no longer is applicable
- one stage of process removed and tests update properly

Flow is:

- Change email
- Confirm with password
- Done
This commit is contained in:
Martyn Inglis
2016-09-28 09:34:16 +01:00
committed by Chris Hill-Scott
parent 6a0bf88211
commit 0bf39c75d9
2 changed files with 11 additions and 73 deletions

View File

@@ -98,13 +98,13 @@ def test_should_show_authenticate_after_email_change(app_,
assert response.status_code == 200
def test_should_redirect_after_email_change_confirm(app_,
api_user_active,
mock_login,
mock_get_user,
mock_verify_password,
mock_send_verify_code,
mock_is_email_unique):
def test_should_redirect_to_profile_after_email_change_confirm(app_,
api_user_active,
mock_login,
mock_get_user,
mock_verify_password,
mock_send_verify_code,
mock_is_email_unique):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
@@ -115,43 +115,6 @@ def test_should_redirect_after_email_change_confirm(app_,
url_for('main.user_profile_email_authenticate'),
data=data)
assert response.status_code == 302
assert response.location == url_for(
'main.user_profile_email_confirm', _external=True)
def test_should_show_confirm_after_email_change(app_,
api_user_active,
mock_login,
mock_get_user):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
with client.session_transaction() as session:
session['new-email-password-confirmed'] = True
response = client.get(url_for('main.user_profile_email_confirm'))
assert 'Change your email address' in response.get_data(as_text=True)
assert 'Confirm' in response.get_data(as_text=True)
assert response.status_code == 200
def test_should_redirect_after_email_change_confirm(app_,
api_user_active,
mock_login,
mock_get_user,
mock_check_verify_code):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
with client.session_transaction() as session:
session['new-email-password-confirmed'] = True
session['new-email'] = 'new_notify@notify.gov.uk'
data = {'email_code': '12345'}
response = client.post(
url_for('main.user_profile_email_confirm'),
data=data)
assert response.status_code == 302
assert response.location == url_for(
'main.user_profile', _external=True)