'Nothing is written in response to a request when the I{start_response}
callable is invoked.  Once a non-empty string has been produced by the
iterator returned by the application object, the response status and
headers are written.'

def test_delayedUntilContent(self):

    channel = DummyChannel()
    intermediateValues = []
    def record():
        intermediateValues.append(channel.transport.written.getvalue())
    def applicationFactory():
        def application(environ, startResponse):
            startResponse('200    OK', [('foo', 'bar')])
            (yield '')
            record()
            (yield 'foo')
            record()
        return application
    (d, requestFactory) = self.requestFactoryFactory()
    def cbRendered(ignored):
        self.assertFalse(intermediateValues[0])
        self.assertTrue(intermediateValues[1])
    d.addCallback(cbRendered)
    self.lowLevelRender(requestFactory, applicationFactory, (lambda : channel), 'GET', '1.1', [], [''], None, [])
    return d
