summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test.py b/test.py
index ed7d6e3..99204de 100755
--- a/test.py
+++ b/test.py
@@ -242,6 +242,12 @@ def writing_application(environ, start_response):
yield ""
yield "second"
+def write_only_application(environ, start_response):
+ write = start_response("200 Ok", [("Content-Type", "text/plain")])
+ write("first")
+ write("second")
+ yield ""
+
class NoWriteCallableMiddlewareTest(unittest.TestCase):
def testWrite(self):
app = middlewares.NoWriteCallableMiddleware(writing_application)
@@ -249,6 +255,12 @@ class NoWriteCallableMiddlewareTest(unittest.TestCase):
self.assertEqual(res.writtendata, [])
self.assertEqual("".join(res.returneddata), "firstsecond")
+ def testWriteOnly(self):
+ app = middlewares.NoWriteCallableMiddleware(write_only_application)
+ res = Request(self)(app)
+ self.assertEqual(res.writtendata, [])
+ self.assertEqual("".join(res.returneddata), "firstsecond")
+
class StupidIO:
"""file-like without tell method, so StaticFile is not able to
determine the content-length."""