Skip to content
Myr

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 file

Take 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 back
1import pytest
23import httpx45

Drop sync (#544)Tom Christiebefore adoption206c537

lines 6–8why, one step back
6@pytest.mark.asyncio
7async 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 back
9 assert response.status_code == 200
10 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 back
12 assert response.http_version == "HTTP/1.1"

Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb

lines 13–14why, one step back
13
14

Drop sync (#544)Tom Christiebefore adoption206c537

lines 15–17why, one step back
15@pytest.mark.asyncio
16async 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 back
18 assert response.status_code == 200
19 assert response.reason_phrase == "OK"2021

Drop sync (#544)Tom Christiebefore adoption206c537

lines 22–24why, one step back
22@pytest.mark.asyncio
23async 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 back
25 yield b"Hello"
26 yield b", "27 yield b"world!"28

Drop sync (#544)Tom Christiebefore adoption206c537

line 29why, one step back
29 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 back
30 assert response.status_code == 200
31 assert response.reason_phrase == "OK"3233

Drop sync (#544)Tom Christiebefore adoption206c537

lines 34–36why, one step back
34@pytest.mark.asyncio
35async 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 back
37 assert response.status_code == 200
38 assert response.reason_phrase == "OK"3940

Drop sync (#544)Tom Christiebefore adoption206c537

lines 41–43why, one step back
41@pytest.mark.asyncio
42async 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 back
44 assert response.status_code == 200
45 assert response.reason_phrase == "OK"4647

Drop sync (#544)Tom Christiebefore adoption206c537

lines 48–50why, one step back
48@pytest.mark.asyncio
49async 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 back
51 assert response.status_code == 200
52 assert response.reason_phrase == "OK"5354

Drop sync (#544)Tom Christiebefore adoption206c537

lines 55–57why, one step back
55@pytest.mark.asyncio
56async 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 back
58 assert response.status_code == 200
59 assert response.reason_phrase == "OK"6061

Drop sync (#544)Tom Christiebefore adoption206c537

lines 62–64why, one step back
62@pytest.mark.asyncio
63async 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 back
65 assert response.status_code == 200
66 assert response.reason_phrase == "OK"6768

Drop sync (#544)Tom Christiebefore adoption206c537

lines 69–70why, one step back
69@pytest.mark.asyncio
70async def test_get_invalid_url(server):

Explicitly check is_redirect in simple test case (#208)Tammo Behrendsbefore adoptionbebedcb

line 71why, one step back
71 with pytest.raises(httpx.InvalidURL):

Drop sync (#544)Tom Christiebefore adoption206c537

line 72why, one step back
72 await httpx.get("invalid://example.org")