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")
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)
def test_invalid_email(): with pytest.raises(InvalidEmail): assert User.from_email('*****@*****.**')
def test_invalid_password(): user = User.from_email(email_address) with pytest.raises(InvalidPassword): assert app.login_user(user, 'WrongPassword')
def test_email_in_use(): user = User.from_email(email_address) with pytest.raises(EmailInUse): assert app.register_user(user)
def test_user_login(): user = User.from_email(email_address) app.login_user(user, password)