def test_reset_password(self): done = u.reset_password_by_username("USER_1", PLAINTEXT) assert done with db.conn() as conn: result = conn.execute(text(""" SELECT password FROM app_{0}._user WHERE username=:username """.format(self.app_name)), username='******') r = result.fetchone() assert_correct_pw(PLAINTEXT, r[0])
def test_bad_parameter(self): with pytest.raises(ValueError): u.reset_password_by_username(1, '') with pytest.raises(ValueError): u.reset_password_by_username('', 1)
def test_no_such_user(self): done = u.reset_password_by_username("USER_2", PLAINTEXT) assert not done