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

Function test_write_payload_length

tests/test_protocol.py:401–413  ·  view source on GitHub ↗
(transport)

Source from the content-addressed store, hash-verified

399
400
401def test_write_payload_length(transport):
402 write = transport.write = mock.Mock()
403
404 msg = protocol.Response(transport, 200)
405 msg.add_headers(('content-length', '2'))
406 msg.send_headers()
407
408 msg.write(b'd')
409 msg.write(b'ata')
410 msg.write_eof()
411
412 content = b''.join([c[1][0] for c in list(write.mock_calls)])
413 assert b'da' == content.split(b'\r\n\r\n', 1)[-1]
414
415
416def test_write_payload_chunked_filter(transport):

Callers

nothing calls this directly

Calls 4

write_eofMethod · 0.95
add_headersMethod · 0.80
send_headersMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected