Ejemplo n.º 1
0
def test_account_locked():
    user = User.from_email(email_address)
    user.login_attempts = 2
    with pytest.raises(InvalidPassword):
        assert app.login_user(user, 'WrongPassword')
    with pytest.raises(AccountLocked):
        app.login_user(user, "WrongPassword")
Ejemplo n.º 2
0
def test_register_user(db_session):
    db_session()
    try:
        user = User.from_email(email_address)
        app.delete_user(user)
    except InvalidEmail:
        pass

    user = User(email_address, 'Luke', 'Seabright')
    user.set_password(password)
    app.register_user(user)
Ejemplo n.º 3
0
def test_invalid_email():
    with pytest.raises(InvalidEmail):
        assert User.from_email('*****@*****.**')
Ejemplo n.º 4
0
def test_invalid_password():
    user = User.from_email(email_address)
    with pytest.raises(InvalidPassword):
        assert app.login_user(user, 'WrongPassword')
Ejemplo n.º 5
0
def test_email_in_use():
    user = User.from_email(email_address)
    with pytest.raises(EmailInUse):
        assert app.register_user(user)
Ejemplo n.º 6
0
def test_user_login():
    user = User.from_email(email_address)
    app.login_user(user, password)