def test_handle_request_futures(self):

    def wsgi_app(env, start):
        start('200 OK', [('Content-Type', 'text/plain')])
        f1 = helpers.create_future(self.loop)
        f1.set_result(b'data')
        fut = helpers.create_future(self.loop)
        fut.set_result([f1])
        return fut
    srv = self._make_srv(wsgi_app)
    self.loop.run_until_complete(srv.handle_request(self.message, self.payload))
    content = b''.join([c[1][0] for c in self.writer.write.mock_calls])
    self.assertTrue(content.startswith(b'HTTP/1.0 200 OK'))
    self.assertTrue(content.endswith(b'data'))
def test_handle_request_futures(self):

    def wsgi_app(env, start):
        start('200 OK', [('Content-Type', 'text/plain')])
        f1 = helpers.create_future(self.loop)
        f1.set_result(b'data')
        fut = helpers.create_future(self.loop)
        fut.set_result([f1])
        return fut
    srv = self._make_srv(wsgi_app)
    self.loop.run_until_complete(srv.handle_request(self.message, self.payload))
    content = b.join([c[1][0] for c in self.writer.write.mock_calls])
    self.assertTrue(content.startswith(b'HTTP/1.0 200 OK'))
    self.assertTrue(content.endswith(b'data'))