Exemple #1
0
 def respond_redirect_distro(self, req, distro_id):
     url = req.url_root
     if not url.endswith('/'):
         url += '/'
     if 'text/html' not in req.headers.get('Accept', '').split(','):
         # try to catch setuptools
         url += 'simple/'
     else:
         url += 'd/'
     url += distro_id + '/'
     print url
     raise routing.RequestRedirect(url)
 def test_redirect_request_exception_code(self):
     exc = r.RequestRedirect('http://www.google.com/')
     exc.code = 307
     env = create_environ()
     self.assert_strict_equal(exc.get_response(env).status_code, exc.code)
Exemple #3
0
    def respond_login(self, req):
        remote_user = req.environ.get('REMOTE_USER', None)
        if remote_user:
            raise routing.RequestRedirect(req.url_root)

        return werkzeug.Response('Unauthorized', status=401)
Exemple #4
0
def test_redirect_request_exception_code():
    exc = r.RequestRedirect("http://www.google.com/")
    exc.code = 307
    env = create_environ()
    assert exc.get_response(env).status_code == exc.code