Add common_login test

This commit is contained in:
Joseph Schorr 2017-07-20 14:36:15 -04:00
parent 41ac9019c6
commit 7736de24fe
2 changed files with 26 additions and 1 deletions

View file

@ -48,7 +48,7 @@ def common_login(db_user, permanent_session=True):
return True return True
else: else:
logger.debug('User could not be logged in, inactive?.') logger.debug('User could not be logged in, inactive?')
return False return False

View file

@ -0,0 +1,25 @@
import pytest
from data import model
from endpoints.common import common_login
from test.fixtures import *
@pytest.mark.parametrize('username, expect_success', [
# Valid users.
('devtable', True),
('public', True),
# Org.
('buynlarge', False),
# Robot.
('devtable+dtrobot', False),
# Unverified user.
('unverified', False),
])
def test_common_login(username, expect_success, app):
db_user = model.user.get_namespace_user(username)
with app.app_context():
assert common_login(db_user) == expect_success