MCPcopy
hub / github.com/aio-libs/aiohttp / test_compression_default_coding

Function test_compression_default_coding

tests/test_web_response.py:267–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265
266@pytest.mark.run_loop
267def test_compression_default_coding():
268 req = make_request(
269 'GET', '/',
270 headers=CIMultiDict({hdrs.ACCEPT_ENCODING: 'gzip, deflate'}))
271 resp = StreamResponse()
272 assert not resp.chunked
273
274 assert not resp.compression
275 resp.enable_compression()
276 assert resp.compression
277
278 with mock.patch('aiohttp.web_reqrep.ResponseImpl'):
279 msg = yield from resp.prepare(req)
280
281 msg.add_compression_filter.assert_called_with('deflate')
282 assert 'deflate' == resp.headers.get(hdrs.CONTENT_ENCODING)
283 assert msg.filter is not None
284
285
286@pytest.mark.run_loop

Callers

nothing calls this directly

Calls 6

enable_compressionMethod · 0.95
prepareMethod · 0.95
StreamResponseClass · 0.90
patchMethod · 0.80
make_requestFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected