예제 #1
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def test_non_default_port(self):
     environ = {
         "SERVER_NAME": "localhost",
         "SERVER_PORT": "8080",
         "wsgi.url_scheme": "http",
     }
     self.assertEqual(
         wsgi.Request(environ).url,
         URL(scheme=u"http", host=u"localhost", port=8080),
     )
예제 #2
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def test_no_host_no_path_no_query_string(self):
     environ = {
         "SERVER_NAME": "localhost",
         "SERVER_PORT": "80",
         "wsgi.url_scheme": "http",
     }
     self.assertEqual(
         wsgi.Request(environ).url,
         URL(scheme=u"http", host=u"localhost"),
     )
예제 #3
0
 def test_host_no_path_no_query_string(self):
     environ = {
         "HTTP_HOST": "example.com",
         "SERVER_NAME": "localhost",
         "SERVER_PORT": "80",
         "wsgi.url_scheme": "http",
     }
     self.assertEqual(
         wsgi.Request(environ).url,
         URL(scheme=b"http", host=b"example.com"),
     )
예제 #4
0
 def test_script_name(self):
     environ = {
         "HTTP_HOST": "example.org",
         "SCRIPT_NAME": "/stuff",
         "PATH_INFO": "/things",
         "SERVER_PORT": "443",
         "wsgi.url_scheme": "https",
     }
     self.assertEqual(
         wsgi.Request(environ).url,
         URL(scheme=b"https", host=b"example.org", path=b"/stuff/things"),
     )
예제 #5
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def test_query_string(self):
     environ = {
         "SERVER_NAME": "example.com",
         "SERVER_PORT": "80",
         "QUERY_STRING": "foo=bar",
         "wsgi.url_scheme": "http",
     }
     self.assertEqual(
         wsgi.Request(environ).url, URL(
             scheme=u"http",
             host=u"example.com",
             query=[(u"foo", u"bar")],
         ),
     )
예제 #6
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def test_no_http_host_present(self):
     environ = {
         "SERVER_NAME": "example.org",
         "SERVER_PORT": "1234",
         "PATH_INFO": "/",
         "wsgi.url_scheme": "https",
     }
     self.assertEqual(
         wsgi.Request(environ).url, URL(
             scheme=u"https",
             host=u"example.org",
             path=[u""],
             port=1234,
         ),
     )
예제 #7
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def test_http_host_present_default_port(self):
     environ = {
         "HTTP_HOST": "example.org:80",
         "SERVER_PORT": "80",
         "PATH_INFO": "/",
         "wsgi.url_scheme": "https",
     }
     self.assertEqual(
         wsgi.Request(environ).url, URL(
             scheme=u"https",
             host=u"example.org",
             path=[u""],
             port=80,
         ),
     )
예제 #8
0
파일: test_wsgi.py 프로젝트: Julian/Minion
 def make_request(self, headers):
     headers = {k: b",".join(v) for k, v in headers.canonicalized()}
     return wsgi.Request(environ=create_environ(headers=headers))