()
| 20 | @pytest.mark.asyncio |
| 21 | @pytest.mark.flaky(reruns=3, reruns_delay=2) |
| 22 | async 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 |
nothing calls this directly
no test coverage detected