summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-01-24 15:45:39 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-01-24 15:45:39 +0300
commit17e1a19063af901ed4c6b490d654f30d4b2b3a93 (patch)
treeef77e821da23e1a28b8b72d6d7873adc6abfd475 /test
parent955ba9d7dde780aec69744af84ae39aab129468c (diff)
downloadunit-17e1a19063af901ed4c6b490d654f30d4b2b3a93.tar.gz
unit-17e1a19063af901ed4c6b490d654f30d4b2b3a93.tar.bz2
Tests: added test for QUERY_STRING variable.
Diffstat (limited to 'test')
-rw-r--r--test/test_python_application.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_python_application.py b/test/test_python_application.py
index c9be46af..d1790bf6 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -80,6 +80,40 @@ def application(environ, start_response):
}, 'headers')
self.assertEqual(r.content, str.encode(body), 'body')
+ def test_python_application_query_string(self):
+ code, name = """
+
+def application(environ, start_response):
+
+ start_response('200 OK', [
+ ('Content-Length', '0'),
+ ('Request-Method', environ.get('REQUEST_METHOD')),
+ ('Request-Uri', environ.get('REQUEST_URI')),
+ ('Path-Info', environ.get('PATH_INFO')),
+ ('Query-String', environ.get('QUERY_STRING'))
+ ])
+ return []
+
+""", 'py_app'
+
+ self.python_application(name, code)
+ self.put('/', self.conf % (self.testdir + '/' + name))
+
+ r = unit.TestUnitHTTP.get(uri='/?var1=val1&var2=val2', headers={
+ 'Host': 'localhost'
+ })
+
+ self.assertEqual(r.status_code, 200, 'status')
+ headers = dict(r.headers)
+ headers.pop('Server')
+ self.assertDictEqual(headers, {
+ 'Content-Length': '0',
+ 'Request-Method': 'GET',
+ 'Query-String': 'var1=val1&var2=val2',
+ 'Request-Uri': '/?var1=val1&var2=val2',
+ 'Path-Info': '/'
+ }, 'headers')
+
@unittest.expectedFailure
def test_python_application_server_port(self):
code, name = """