summaryrefslogtreecommitdiff
path: root/tests/fixtureapps/nocl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fixtureapps/nocl.py')
-rw-r--r--tests/fixtureapps/nocl.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/fixtureapps/nocl.py b/tests/fixtureapps/nocl.py
new file mode 100644
index 0000000..f82bba0
--- /dev/null
+++ b/tests/fixtureapps/nocl.py
@@ -0,0 +1,23 @@
+def chunks(l, n): # pragma: no cover
+ """ Yield successive n-sized chunks from l.
+ """
+ for i in range(0, len(l), n):
+ yield l[i : i + n]
+
+
+def gen(body): # pragma: no cover
+ for chunk in chunks(body, 10):
+ yield chunk
+
+
+def app(environ, start_response): # pragma: no cover
+ cl = environ.get("CONTENT_LENGTH", None)
+ if cl is not None:
+ cl = int(cl)
+ body = environ["wsgi.input"].read(cl)
+ start_response("200 OK", [("Content-Type", "text/plain")])
+ if environ["PATH_INFO"] == "/list":
+ return [body]
+ if environ["PATH_INFO"] == "/list_lentwo":
+ return [body[0:1], body[1:]]
+ return gen(body)