summaryrefslogtreecommitdiffhomepage
path: root/test/test_python_keepalive.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-02-20 20:34:41 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-02-20 20:34:41 +0300
commit09f2009df564ab2063ee4713ba24247039945146 (patch)
tree5c719060dd4af2ca932da96d93d77eeebc6c5f25 /test/test_python_keepalive.py
parentbabf67712e4226527730e2fb8c96babdf5486ca5 (diff)
downloadunit-09f2009df564ab2063ee4713ba24247039945146.tar.gz
unit-09f2009df564ab2063ee4713ba24247039945146.tar.bz2
Tests: reworked python tests with application.
Diffstat (limited to 'test/test_python_keepalive.py')
-rw-r--r--test/test_python_keepalive.py35
1 files changed, 2 insertions, 33 deletions
diff --git a/test/test_python_keepalive.py b/test/test_python_keepalive.py
index eadf922c..0472a15b 100644
--- a/test/test_python_keepalive.py
+++ b/test/test_python_keepalive.py
@@ -1,44 +1,13 @@
import unittest
import unit
-class TestUnitPythonKeepalive(unit.TestUnitControl):
+class TestUnitPythonKeepalive(unit.TestUnitApplicationPython):
def setUpClass():
unit.TestUnit().check_modules('python')
def test_python_keepalive_body(self):
- code, name = """
-
-def application(environ, start_response):
-
- content_length = int(environ.get('CONTENT_LENGTH', 0))
- body = bytes(environ['wsgi.input'].read(content_length))
-
- start_response('200', [
- ('Content-Type', environ.get('CONTENT_TYPE')),
- ('Content-Length', str(len(body)))
- ])
- return [body]
-
-""", 'py_app'
-
- self.python_application(name, code)
-
- self.conf({
- "listeners": {
- "*:7080": {
- "application": "app"
- }
- },
- "applications": {
- "app": {
- "type": "python",
- "processes": { "spare": 0 },
- "path": self.testdir + '/' + name,
- "module": "wsgi"
- }
- }
- })
+ self.load('mirror')
(resp, sock) = self.post(headers={
'Connection': 'keep-alive',