Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
Enome opened this Issue · 2 comments

2 participants

@Enome

In my handler I have:
self.error(403)

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,
               res.body))

I guess the above piece of code is the problem.

@jgeewax
Owner

Are you using self.get (or post, put, delete...)? (see http://github.com/jgeewax/gaetestbed/blob/master/gaetestbed/web.py#L109)

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

@Enome

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
Something went wrong with that request. Please try again.