MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / test_multiple_requests

Function test_multiple_requests

tests/response_test.py:22–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20@pytest.mark.asyncio
21@pytest.mark.flaky(reruns=3, reruns_delay=2)
22async def test_multiple_requests():
23 async def file_to_bytes_stream(file_path):
24 with open(file_path, "rb") as f:
25 while chunk := f.read(1024):
26 yield chunk
27
28 resp = await client.post(
29 "https://httpbin.org/anything",
30 multipart=Multipart(
31 Part(name="def", value="111", filename="def.txt", mime="text/plain"),
32 Part(name="abc", value=b"000", filename="abc.txt", mime="text/plain"),
33 Part(
34 name="LICENSE",
35 value=Path("./LICENSE"),
36 filename="LICENSE",
37 mime="text/plain",
38 ),
39 Part(
40 name="Cargo.toml",
41 value=file_to_bytes_stream("./Cargo.toml"),
42 filename="Cargo.toml",
43 mime="text/plain",
44 ),
45 ),
46 )
47 assert resp.status == 200
48 assert resp.status_code.is_success() is True
49 text = await resp.text()
50 assert "111" in text
51 assert "000" in text
52 assert "rnet" in text
53
54
55@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 6

MultipartClass · 0.85
PartClass · 0.85
is_successMethod · 0.80
file_to_bytes_streamFunction · 0.70
postMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected