Reintroduce some tests. A bit of cleanup of mocks.

User object fields made a bit clearer and simple test to
verify user added.
This commit is contained in:
Adam Shimali
2016-01-23 23:14:50 +00:00
parent ba0d0d49e1
commit 4674bd6b68
23 changed files with 493 additions and 453 deletions

View File

@@ -1,6 +1,4 @@
from flask import url_for
from app.main.dao import users_dao
from tests import create_test_user
def test_should_render_forgot_password(app_, db_, db_session):
@@ -15,15 +13,15 @@ def test_should_redirect_to_password_reset_sent_and_state_updated(app_,
db_,
db_session,
mock_send_email,
mock_api_user,
mock_user_dao_get_by_email,
mock_user_dao_password_reset):
mock_active_user,
mock_get_by_email,
mock_password_reset):
with app_.test_request_context():
response = app_.test_client().post(
url_for('.forgot_password'),
data={'email_address': mock_api_user.email_address})
data={'email_address': mock_active_user.email_address})
assert response.status_code == 200
assert (
'You have been sent an email containing a link'
' to reset your password.') in response.get_data(as_text=True)
assert mock_api_user.state == 'request_password_reset'
assert mock_active_user.state == 'request_password_reset'