Skip to content

Commit

Permalink
add failing test for #44. Publish IUnboundStreamIterator via publish_…
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
Gerhard Weis committed Feb 25, 2016
1 parent 5f2ba1e commit 31dd90d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/ZPublisher/tests/test_WSGIPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,31 @@ def next(self):
app_iter = self._callFUT(environ, start_response, _publish)
self.assertTrue(app_iter is body)

def test_response_is_unboundstream(self):
from ZPublisher.Iterators import IUnboundStreamIterator
from zope.interface import implements

class test_unboundstreamiterator:
implements(IUnboundStreamIterator)
data = "hello"
done = 0

def next(self):
if not self.done:
self.done = 1
return self.data
raise StopIteration

_response = DummyResponse()
_response._status = '200 OK'
body = _response.body = test_unboundstreamiterator()
environ = self._makeEnviron()
start_response = DummyCallable()
_publish = DummyCallable()
_publish._result = _response
app_iter = self._callFUT(environ, start_response, _publish)
self.assertTrue(app_iter is body)

def test_request_closed_when_tm_middleware_not_active(self):
environ = self._makeEnviron()
start_response = DummyCallable()
Expand Down

0 comments on commit 31dd90d

Please sign in to comment.