Verify activate and login user with sms and email code

This commit is contained in:
Adam Shimali
2016-01-20 15:13:15 +00:00
parent 5924500f3e
commit ca3d3240a6
19 changed files with 269 additions and 134 deletions

View File

@@ -5,12 +5,13 @@ from app.main.encryption import check_hash
from app.notify_client.sender import generate_token
from tests import create_test_user
import pytest
def test_should_render_new_password_template(app_, db_, db_session):
def test_should_render_new_password_template(app_, db_, db_session, mock_api_user, mock_user_dao_get_new_password):
with app_.test_request_context():
with app_.test_client() as client:
user = create_test_user('request_password_reset')
token = generate_token(user.email_address)
token = generate_token(mock_api_user.email_address)
response = client.get(url_for('.new_password', token=token))
assert response.status_code == 200
assert ' You can now create a new password for your account.' in response.get_data(as_text=True)
@@ -27,10 +28,13 @@ def test_should_render_new_password_template_with_message_of_bad_token(app_, db_
response.get_data(as_text=True)
@pytest.mark.xfail(reason='Password reset not implemented')
def test_should_redirect_to_two_factor_when_password_reset_is_successful(app_,
db_,
db_session,
mock_send_sms):
mock_send_sms,
mock_api_user,
mock_user_dao_get_new_password):
with app_.test_request_context():
with app_.test_client() as client:
user = create_test_user('request_password_reset')