def test_set_cork_prepared(): resp = StreamResponse() writer = mock.Mock() req = make_request('GET', '/', writer=writer) yield from resp.prepare(req) resp.set_tcp_cork(True) writer.set_tcp_cork.assert_called_with(True)
def test_set_cork_prepared(): resp = StreamResponse() writer = mock.Mock() req = make_request('GET', '/', payload_writer=writer) yield from resp.prepare(req) resp.set_tcp_cork(True) writer.set_tcp_cork.assert_called_with(True)
def test_set_tcp_cork_on_start(): req = make_request('GET', '/') resp = StreamResponse() resp.set_tcp_cork(True) with mock.patch('aiohttp.web_reqrep.ResponseImpl'): resp_impl = yield from resp.prepare(req) resp_impl.transport.set_tcp_nodelay.assert_called_with(False) resp_impl.transport.set_tcp_cork.assert_called_with(True)
def test_set_tcp_cork_on_start(): req = make_request('GET', '/') resp = StreamResponse() resp.set_tcp_cork(True) with mock.patch('aiohttp.web_reqrep.ResponseImpl'): resp_impl = yield from resp.prepare(req) resp_impl.transport.set_tcp_nodelay.assert_called_with(False) resp_impl.transport.set_tcp_cork.assert_called_with(True)
def test_set_tcp_cork_before_start(): resp = StreamResponse() resp.set_tcp_cork(True) assert resp.tcp_cork resp.set_tcp_cork(False) assert not resp.tcp_cork
def test_set_tcp_cork_before_start(): resp = StreamResponse() resp.set_tcp_cork(True) assert resp.tcp_cork resp.set_tcp_cork(False) assert not resp.tcp_cork
def test_set_cork_unprepared(): resp = StreamResponse() with pytest.raises(RuntimeError): resp.set_tcp_cork(True)
def test_set_cork_unprepared(): resp = StreamResponse() with pytest.raises(AssertionError): resp.set_tcp_cork(True)