assertForbidden doesn't work because webtest throws error on 403 #5

Enome opened this Issue Aug 27, 2010 · 2 comments


None yet

2 participants

Enome commented Aug 27, 2010

In my handler I have:

But before I can test it with assertForbidden webtest will throw AppError line 403(yeah I know creepy coincidence).

 if res.status_int >= 200 and res.status_int < 400:
      return raise AppError(
            "Bad response: %s (not 200 OK or 3xx redirect for %s)\n%s"
            % (res.status, res.request.url,

I guess the above piece of code is the problem.

jgeewax commented Aug 27, 2010

Are you using self.get (or post, put, delete...)? (see

Those methods set the "status" keyword argument to * which effectively says "even if there's an error, return nicely".

Enome commented Aug 27, 2010

Aha, thanks I was indeed not using self I was using the app directly.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment