108536490: Adding the login manager and csrf token.

Still need to figure out how to override the load_user method, currently it is not working.
This commit is contained in:
Rebecca Law
2015-11-27 16:25:56 +00:00
parent 7f96ef5a25
commit 48b7a7dc37
12 changed files with 130 additions and 27 deletions

View File

@@ -1,3 +1,7 @@
from datetime import datetime
from app.main.dao import users_dao
from app.models import Users
def test_render_sign_in_returns_sign_in_template(notifications_admin):
@@ -9,9 +13,24 @@ def test_render_sign_in_returns_sign_in_template(notifications_admin):
assert 'Forgotten password?' in response.get_data(as_text=True)
def test_process_sign_in_return_2fa_template(notifications_admin):
def test_process_sign_in_return_2fa_template(notifications_admin, notifications_admin_db):
user = Users(email_address='valid@example.gov.uk',
password='val1dPassw0rd!',
mobile_number='+441234123123',
name='valid',
created_at=datetime.now(),
role_id=1)
users_dao.insert_user(user)
response = notifications_admin.test_client().post('/sign-in',
data={'email_address': 'valid@example.gov.uk',
'password': 'val1dPassw0rd!'})
assert response.status_code == 302
assert response.location == 'http://localhost/two-factor'
def test_temp_create_user(notifications_admin, notifications_admin_db):
response = notifications_admin.test_client().post('/temp-create-users',
data={'email_address': 'testing@example.gov.uk',
'password': 'val1dPassw0rd!'})
assert response.status_code == 302