'When getting a redirect on an unsupported request method,
L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping
a L{error.PageRedirect} exception.
@param code: HTTP status code.
@param method: HTTP request method.'

def _testPageRedirectFailure(self, code, method):

    deferred = self.agent.request(method, 'http://example.com/foo')
    (req, res) = self.protocol.requests.pop()
    headers = http_headers.Headers()
    response = Response(('HTTP', 1, 1), code, 'OK', headers, None)
    res.callback(response)
    fail = self.failureResultOf(deferred, client.ResponseFailed)
    fail.value.reasons[0].trap(error.PageRedirect)
    self.assertEqual('http://example.com/foo', fail.value.reasons[0].value.location)
    self.assertEqual(code, fail.value.response.code)
