diff options
-rwxr-xr-x | test.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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.""" |