def function1736(self): var4070 = aiohttp.FlowControlDataQueue(self.attribute1609) var4592 = HttpPayloadParser(var4070, readall=True) var4592.feed_data(b'data') var4592.feed_eof() self.assertTrue(var4070.is_eof()) self.assertEqual([(bytearray(b'data'), 4)], list(var4070._buffer))
def test_parse_length_payload_eof(self, stream): out = aiohttp.FlowControlDataQueue(stream) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') with pytest.raises(http_exceptions.ContentLengthError): p.feed_eof()
def test_parse_eof_payload(self, stream): out = aiohttp.FlowControlDataQueue(stream) p = HttpPayloadParser(out, readall=True) p.feed_data(b'data') p.feed_eof() assert out.is_eof() assert [(bytearray(b'data'), 4)] == list(out._buffer)
def test_parse_length_payload_eof(self, stream): out = aiohttp.FlowControlDataQueue(stream) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') with pytest.raises(http_exceptions.ContentLengthError): p.feed_eof()
def test_parse_eof_payload(self, stream): out = aiohttp.FlowControlDataQueue(stream) p = HttpPayloadParser(out, readall=True) p.feed_data(b'data') p.feed_eof() assert out.is_eof() assert [(bytearray(b'data'), 4)] == list(out._buffer)
def test_parse_eof_payload(self): out = aiohttp.FlowControlDataQueue(self.stream) p = HttpPayloadParser(out, readall=True) p.feed_data(b'data') p.feed_eof() self.assertTrue(out.is_eof()) self.assertEqual([(bytearray(b'data'), 4)], list(out._buffer))
async def test_parse_length_payload_eof(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') with pytest.raises(http_exceptions.ContentLengthError): p.feed_eof()
async def test_parse_eof_payload(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, readall=True) p.feed_data(b'data') p.feed_eof() assert out.is_eof() assert [(bytearray(b'data'), 4)] == list(out._buffer)
async def test_parse_length_payload_eof(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') with pytest.raises(http_exceptions.ContentLengthError): p.feed_eof()
async def test_parse_eof_payload(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, readall=True) p.feed_data(b'data') p.feed_eof() assert out.is_eof() assert [(bytearray(b'data'), 4)] == list(out._buffer)
async def test_http_payload_parser_deflate_split_err(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, compression='deflate', readall=True) # Feeding one wrong byte should be enough to choose exact # deflate decompressor p.feed_data(b'K', 1) p.feed_data(b'I,I\x04\x00', 5) p.feed_eof() assert b'data' == b''.join(d for d, _ in out._buffer)
async def test_http_payload_parser_deflate_split(self, stream) -> None: out = aiohttp.FlowControlDataQueue(stream, 2**16, loop=asyncio.get_event_loop()) p = HttpPayloadParser(out, compression="deflate", readall=True) # Feeding one correct byte should be enough to choose exact # deflate decompressor p.feed_data(b"x", 1) p.feed_data(b"\x9cKI,I\x04\x00\x04\x00\x01\x9b", 11) p.feed_eof() assert b"data" == b"".join(d for d, _ in out._buffer)
def test_parse_length_payload_eof(self): out = aiohttp.FlowControlDataQueue(self.stream) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') p.feed_eof()
def test_parse_length_payload_eof(self): out = aiohttp.FlowControlDataQueue(self.stream) p = HttpPayloadParser(out, length=4) p.feed_data(b'da') p.feed_eof()
def function1379(self): var1319 = aiohttp.FlowControlDataQueue(self.attribute1609) var703 = HttpPayloadParser(var1319, length=4) var703.feed_data(b'da') with pytest.raises(http_exceptions.ContentLengthError): var703.feed_eof()