test_connections.py
This file
Path
tests/dispatch/test_connections.py
42 lines · 1.3 KiB · Python
Last changed by
Status code tweaks (#77)Tom Christiebefore adoptionc12c271
History of this fileTake it
Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 1–2why, one step back1import pytest2Merge pull request #57 from yeraydiazdiaz/test-httpsTom Christiebefore adoptionc27c635
line 3why, one step back3from httpcore import HTTPConnection, Request, SSLConfigRejig 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/")Merge pull request #57 from yeraydiazdiaz/test-httpsTom Christiebefore adoptionc27c635
lines 10–14why, one step back10 assert response.status_code == 20011 assert response.content == b"Hello, world!"121314@pytest.mark.asyncioWork on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 15–16why, one step back15async def test_post(server):16 conn = HTTPConnection(origin="http://127.0.0.1:8000/")Status code tweaks (#77)Tom Christiebefore adoptionc12c271
lines 17–19why, one step back17 response = await conn.request(18 "GET", "http://127.0.0.1:8000/", data=b"Hello, world!"19 )Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
line 20why, one step back20 assert response.status_code == 200Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 21–30why, one step back212223@pytest.mark.asyncio24async def test_https_get_with_ssl_defaults(https_server):25 """26 An HTTPS request, with default SSL configuration set on the client.27 """28 conn = HTTPConnection(origin="https://127.0.0.1:8001/", verify=False)29 response = await conn.request("GET", "https://127.0.0.1:8001/")30 assert response.status_code == 200Response.contentTom Christiebefore adoption4c55113
line 31why, one step back31 assert response.content == b"Hello, world!"Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 32–34why, one step back323334@pytest.mark.asyncioWork on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 35–40why, one step back35async def test_https_get_with_sll_overrides(https_server):36 """37 An HTTPS request, with SSL configuration set on the request.38 """39 conn = HTTPConnection(origin="https://127.0.0.1:8001/")40 response = await conn.request("GET", "https://127.0.0.1:8001/", verify=False)Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
line 41why, one step back41 assert response.status_code == 200Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 42why, one step back42 assert response.content == b"Hello, world!"