Skip to content
Myr

Test `raise_for_status`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Matus Ferech · committed by Matus Ferech · parent 0629e55 · Browse files · 1 file+15 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−0 removed

  • tests:+15 added−0 removed

1 file+15 added−0 removed

modified:tests/test_client.py+15 added
48 unmodified lines
49 response = await client.request(50 "POST", "http://127.0.0.1:8000/", content=hello_world()51 )52 assert response.status_code == 200535455@pytest.mark.asyncio56async def test_raise_for_status(server):57 async with httpcore.Client() as client:58 for status_code in (200, 400, 404, 500, 505):59 response = await client.request(60 "GET", f"http://127.0.0.1:8000/status/{status_code}"61 )6263 if 400 <= status_code < 600:64 with pytest.raises(httpcore.exceptions.HttpError):65 response.raise_for_status()66 else:67 assert response.raise_for_status() is None