示例#1
0
 def _test_url(original_url, rewritten_url, env={}):
     self._set_env(env)
     request = QgsFcgiServerRequest()
     self.assertEqual(request.originalUrl().toString(), original_url)
     self.assertEqual(request.url().toString(), rewritten_url)
     # Check MAP
     if 'QUERY_STRING' in env:
         map = {k.upper(): v[0] for k, v in parse_qs(
             env['QUERY_STRING']).items()}['MAP']
     else:
         map = {k.upper(): v[0] for k, v in parse_qs(
             urlparse(env['REQUEST_URI']).query).items()}['MAP']
     self.assertEqual(request.parameter('MAP'), map)
示例#2
0
 def _test_url(original_url, rewritten_url, env={}):
     self._set_env(env)
     request = QgsFcgiServerRequest()
     self.assertEqual(request.originalUrl().toString(), original_url)
     self.assertEqual(request.url().toString(), rewritten_url)
     # Check MAP
     if 'QUERY_STRING' in env:
         map = {k.upper(): v[0] for k, v in parse_qs(
             env['QUERY_STRING']).items()}['MAP']
     else:
         map = {k.upper(): v[0] for k, v in parse_qs(
             urlparse(env['REQUEST_URI']).query).items()}['MAP']
     self.assertEqual(request.parameter('MAP'), map)
示例#3
0
 def _test_url(url, env={}):
     for k in ('QUERY_STRING', 'REQUEST_URI', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME'):
         try:
             del os.environ[k]
         except KeyError:
             pass
         try:
             os.environ[k] = env[k]
         except KeyError:
             pass
     request = QgsFcgiServerRequest()
     self.assertEqual(request.url().toString(), url)
     # Check MAP
     if 'QUERY_STRING' in env:
         map = {k.upper(): v[0] for k, v in parse_qs(env['QUERY_STRING']).items()}['MAP']
     else:
         map = {k.upper(): v[0] for k, v in parse_qs(urlparse(env['REQUEST_URI']).query).items()}['MAP']
     self.assertEqual(request.parameter('MAP'), map)