test_queryparams.py
This file
Path
tests/client/test_queryparams.py
35 lines · 1.1 KiB · Python
Last changed by
Add `httpx.MockTransport()` (#1401)Tom Christiebefore adoption9c7c2ac
History of this fileTake it
The walk stopped after 200 commits: lines older than a3392c6 point at it.
Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 1why, one step back1import httpxBase URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 2–3why, one step back23Refactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
line 4why, one step back4def hello_world(request: httpx.Request) -> httpx.Response:Support Response(text=...), Response(html=...), Response(json=...) (#1297)Tom Christiebefore adoptionf3c2941
line 5why, one step back5 return httpx.Response(200, text="Hello, world")Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 6–8why, one step back678def test_client_queryparams():Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
lines 9–10why, one step back9 client = httpx.Client(params={"a": "b"})10 assert isinstance(client.params, httpx.QueryParams)Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 11–14why, one step back11 assert client.params["a"] == "b"121314def test_client_queryparams_string():Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
lines 15–16why, one step back15 client = httpx.Client(params="a=b")16 assert isinstance(client.params, httpx.QueryParams)Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 17–18why, one step back17 assert client.params["a"] == "b"18Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 19why, one step back19 client = httpx.Client()Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
line 20why, one step back20 client.params = "a=b" # type: ignoreBetter test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 21why, one step back21 assert isinstance(client.params, httpx.QueryParams)Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 22–24why, one step back22 assert client.params["a"] == "b"2324Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 25why, one step back25def test_client_queryparams_echo():Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 26–28why, one step back26 url = "http://example.org/echo_queryparams"27 client_queryparams = "first=str"28 request_queryparams = {"second": "dict"}Refactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
line 29why, one step back29 client = httpx.Client(Add `httpx.MockTransport()` (#1401)Tom Christiebefore adoption9c7c2ac
line 30why, one step back30 transport=httpx.MockTransport(hello_world), params=client_queryparamsRefactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
line 31why, one step back31 )Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 32why, one step back32 response = client.get(url, params=request_queryparams)Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 33–34why, one step back3334 assert response.status_code == 200Replace httpx.URL for str in tests (#1237)Eduardo Enriquezbefore adoptionaad8209
line 35why, one step back35 assert response.url == "http://example.org/echo_queryparams?first=str&second=dict"