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

Function test_force_compression_gzip

tests/test_web_response.py:317–329  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

315
316@pytest.mark.run_loop
317def test_force_compression_gzip():
318 req = make_request(
319 'GET', '/',
320 headers=CIMultiDict({hdrs.ACCEPT_ENCODING: 'gzip, deflate'}))
321 resp = StreamResponse()
322
323 resp.enable_compression(ContentCoding.gzip)
324 assert resp.compression
325
326 with mock.patch('aiohttp.web_reqrep.ResponseImpl'):
327 msg = yield from resp.prepare(req)
328 msg.add_compression_filter.assert_called_with('gzip')
329 assert 'gzip' == resp.headers.get(hdrs.CONTENT_ENCODING)
330
331
332@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