test_api.py
This file
Path
tests/test_api.py
72 lines · 1.8 KiB · Python
Last changed by
Drop sync (#544)Tom Christiebefore adoption206c537
History of this fileTake it
The walk stopped after 200 commits: lines older than bebedcb point at it.
Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 1–5why, one step back1import pytest23import httpx45Drop sync (#544)Tom Christiebefore adoption206c537
lines 6–8why, one step back6@pytest.mark.asyncio7async def test_get(server):8 response = await httpx.get(server.url)Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 9–11why, one step back9 assert response.status_code == 20010 assert response.reason_phrase == "OK"11 assert response.text == "Hello, world!"Force HTTP/1.1 on short-lived connections (#284)Seth Michael Larsonbefore adoptione7aa6d6
line 12why, one step back12 assert response.http_version == "HTTP/1.1"Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 13–14why, one step back1314Drop sync (#544)Tom Christiebefore adoption206c537
lines 15–17why, one step back15@pytest.mark.asyncio16async def test_post(server):17 response = await httpx.post(server.url, data=b"Hello, world!")Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 18–21why, one step back18 assert response.status_code == 20019 assert response.reason_phrase == "OK"2021Drop sync (#544)Tom Christiebefore adoption206c537
lines 22–24why, one step back22@pytest.mark.asyncio23async def test_post_byte_iterator(server):24 async def data():Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 25–28why, one step back25 yield b"Hello"26 yield b", "27 yield b"world!"28Drop sync (#544)Tom Christiebefore adoption206c537
line 29why, one step back29 response = await httpx.post(server.url, data=data())Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 30–33why, one step back30 assert response.status_code == 20031 assert response.reason_phrase == "OK"3233Drop sync (#544)Tom Christiebefore adoption206c537
lines 34–36why, one step back34@pytest.mark.asyncio35async def test_options(server):36 response = await httpx.options(server.url)Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 37–40why, one step back37 assert response.status_code == 20038 assert response.reason_phrase == "OK"3940Drop sync (#544)Tom Christiebefore adoption206c537
lines 41–43why, one step back41@pytest.mark.asyncio42async def test_head(server):43 response = await httpx.head(server.url)Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 44–47why, one step back44 assert response.status_code == 20045 assert response.reason_phrase == "OK"4647Drop sync (#544)Tom Christiebefore adoption206c537
lines 48–50why, one step back48@pytest.mark.asyncio49async def test_put(server):50 response = await httpx.put(server.url, data=b"Hello, world!")Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 51–54why, one step back51 assert response.status_code == 20052 assert response.reason_phrase == "OK"5354Drop sync (#544)Tom Christiebefore adoption206c537
lines 55–57why, one step back55@pytest.mark.asyncio56async def test_patch(server):57 response = await httpx.patch(server.url, data=b"Hello, world!")Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 58–61why, one step back58 assert response.status_code == 20059 assert response.reason_phrase == "OK"6061Drop sync (#544)Tom Christiebefore adoption206c537
lines 62–64why, one step back62@pytest.mark.asyncio63async def test_delete(server):64 response = await httpx.delete(server.url)Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
lines 65–68why, one step back65 assert response.status_code == 20066 assert response.reason_phrase == "OK"6768Drop sync (#544)Tom Christiebefore adoption206c537
lines 69–70why, one step back69@pytest.mark.asyncio70async def test_get_invalid_url(server):Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb
line 71why, one step back71 with pytest.raises(httpx.InvalidURL):Drop sync (#544)Tom Christiebefore adoption206c537
line 72why, one step back72 await httpx.get("invalid://example.org")