Comment 2 for bug 98482

Revision history for this message
James Henstridge (jamesh) wrote :

I ended up doing the test something like this:

    >>> browser.mech_browser.set_handle_redirect(False)
    >>> from urllib2 import HTTPError
    >>> try:
    ... browser.open('url-that-should-redirect')
    ... except HTTPError, exc:
    ... print str(exc)
    ... print exc.headers.getheader('Location')
    HTTP Error 303: See Other
    redirect-destination-url

Accessing the network from the tests was never my intention: rather just to check that the destination of the redirect was correct.

Maybe some API to do the equivalent of the set_handle_redirect(False) call would be appropriate?