summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-04-26 17:37:24 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-04-26 17:37:24 +0300
commita44d358f2949e420dc82b530e07f21ae158f00ae (patch)
treec23867f1e597d97fdfb1abcc40066ef3cf7b2c34 /test
parentd1b0f7455019b1234b2093cf9b0f1742e07b460f (diff)
downloadunit-a44d358f2949e420dc82b530e07f21ae158f00ae.tar.gz
unit-a44d358f2949e420dc82b530e07f21ae158f00ae.tar.bz2
Tests: added test for callable write() in Python.
Diffstat (limited to 'test')
-rw-r--r--test/python/write/wsgi.py5
-rw-r--r--test/test_python_application.py5
2 files changed, 10 insertions, 0 deletions
diff --git a/test/python/write/wsgi.py b/test/python/write/wsgi.py
new file mode 100644
index 00000000..6c90b014
--- /dev/null
+++ b/test/python/write/wsgi.py
@@ -0,0 +1,5 @@
+def application(env, start_response):
+ write = start_response('200', [('Content-Length', '10')])
+ write(b'012')
+ write(b'345')
+ return b'6789'
diff --git a/test/test_python_application.py b/test/test_python_application.py
index f54d5803..1a6560e5 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -238,5 +238,10 @@ class TestUnitPythonApplication(unit.TestUnitApplicationPython):
r'\[error\].+the application returned not an iterable object'),
'not iterable')
+ def test_python_application_write(self):
+ self.load('write')
+
+ self.assertEqual(self.get()['body'], '0123456789', 'write')
+
if __name__ == '__main__':
unittest.main()