@ensure_empty_collections("users", "teams")
    @clear_collections("users", "teams")
    def test_change_password_user(self):

        tid = api.team.create_team(base_team.copy())
        uid = api.user.create_user("fred", "fred", "fred", "fred@gmail.com", "HASH", tid)

        old_hash = api.user.get_user(uid=uid)["password_hash"]
        assert old_hash == "HASH", "Was unable to confirm password was stored correctly."

        api.user.update_password_request({"new-password":"HACK", "new-password-confirmation":"HACK"}, uid)

        new_hash = api.user.get_user(uid=uid)["password_hash"]

        assert bcrypt.hashpw("HACK", new_hash) == new_hash, \
            "Password does not match hashed plaintext after changing it."

        with pytest.raises(WebException):
            api.user.update_password_request({"new-password": "", "new-password-confirmation":""}, uid)
            assert False, "Should not be able to update password to nothing."
Tests password change functionality.
dataset/ETHPy150Open EasyCTF/easyctf-2015/api/tests/user_test.py/TestUsers.test_change_password_user