Esempio n. 1
0
    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])
Esempio n. 2
0
    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])
Esempio n. 3
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)
Esempio n. 4
0
 def test_no_such_user(self):
     done = u.reset_password_by_username("USER_2", PLAINTEXT)
     assert not done
Esempio n. 5
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)
Esempio n. 6
0
 def test_no_such_user(self):
     done = u.reset_password_by_username("USER_2", PLAINTEXT)
     assert not done