test_connections.py
This file
Path
tests/dispatch/test_connections.py
45 lines · 1.4 KiB · Python
Last changed by
Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
History of this fileTake it
Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 1–2why, one step back1import pytest2Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 3why, one step back3from httpx import HTTPConnectionRejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 4–7why, one step back456@pytest.mark.asyncio7async def test_get(server):Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 8why, one step back8 conn = HTTPConnection(origin="http://127.0.0.1:8000/")Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 9why, one step back9 response = await conn.request("GET", "http://127.0.0.1:8000/")Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 10why, one step back10 await response.read()Merge pull request #57 from yeraydiazdiaz/test-httpsTom Christiebefore adoptionc27c635
lines 11–15why, one step back11 assert response.status_code == 20012 assert response.content == b"Hello, world!"131415@pytest.mark.asyncioWork on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 16–17why, one step back16async def test_post(server):17 conn = HTTPConnection(origin="http://127.0.0.1:8000/")Status code tweaks (#77)Tom Christiebefore adoptionc12c271
lines 18–20why, one step back18 response = await conn.request(19 "GET", "http://127.0.0.1:8000/", data=b"Hello, world!"20 )Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
line 21why, one step back21 assert response.status_code == 200Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 22–30why, one step back222324@pytest.mark.asyncio25async def test_https_get_with_ssl_defaults(https_server):26 """27 An HTTPS request, with default SSL configuration set on the client.28 """29 conn = HTTPConnection(origin="https://127.0.0.1:8001/", verify=False)30 response = await conn.request("GET", "https://127.0.0.1:8001/")Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 31why, one step back31 await response.read()Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 32why, one step back32 assert response.status_code == 200Response.contentTom Christiebefore adoption4c55113
line 33why, one step back33 assert response.content == b"Hello, world!"Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 34–36why, one step back343536@pytest.mark.asyncioWork on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 37–42why, one step back37async def test_https_get_with_sll_overrides(https_server):38 """39 An HTTPS request, with SSL configuration set on the request.40 """41 conn = HTTPConnection(origin="https://127.0.0.1:8001/")42 response = await conn.request("GET", "https://127.0.0.1:8001/", verify=False)Sync or Async dispatch (#83)Tom Christiebefore adoption0cbf3c7
line 43why, one step back43 await response.read()Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
line 44why, one step back44 assert response.status_code == 200Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 45why, one step back45 assert response.content == b"Hello, world!"