test_connections.py
This file
Path
tests/dispatch/test_connections.py
51 lines · 1.9 KiB · Python
Last changed by
Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
History of this fileTake it
The walk stopped after 200 commits: lines older than a960a2a point at it.
Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
line 1why, one step back1import pytestRelease semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
line 2why, one step back2Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
lines 3–4why, one step back3import httpx4from httpx.dispatch.connection import HTTPConnectionRelease semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
line 5why, one step back5Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
line 6why, one step back6Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 7why, one step back7async def test_get(server, backend):Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
lines 8–9why, one step back8 async with HTTPConnection(origin=server.url, backend=backend) as conn:9 response = await conn.request("GET", server.url)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 10–12why, one step back10 await response.read()11 assert response.status_code == 20012 assert response.content == b"Hello, world!"Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
lines 13–14why, one step back1314Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 15why, one step back15async def test_post(server, backend):Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
lines 16–17why, one step back16 async with HTTPConnection(origin=server.url, backend=backend) as conn:17 response = await conn.request("GET", server.url, data=b"Hello, world!")Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 18why, one step back18 assert response.status_code == 200Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
lines 19–21why, one step back192021async def test_premature_close(server, backend):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 22why, one step back22 with pytest.raises(httpx.ConnectionClosed):Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
lines 23–27why, one step back23 async with HTTPConnection(origin=server.url, backend=backend) as conn:24 response = await conn.request(25 "GET", server.url.copy_with(path="/premature_close")26 )27 await response.read()Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
lines 28–29why, one step back2829Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 30why, one step back30async def test_https_get_with_ssl_defaults(https_server, ca_cert_pem_file, backend):Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
lines 31–33why, one step back31 """32 An HTTPS request, with default SSL configuration set on the client.33 """Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 34why, one step back34 async with HTTPConnection(Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 35why, one step back35 origin=https_server.url, verify=ca_cert_pem_file, backend=backendServe test server in thread (#292)Florimond Mancabefore adoption994403b
line 36why, one step back36 ) as conn:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 37why, one step back37 response = await conn.request("GET", https_server.url)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 38–40why, one step back38 await response.read()39 assert response.status_code == 20040 assert response.content == b"Hello, world!"Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
lines 41–42why, one step back4142Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 43why, one step back43async def test_https_get_with_sll_overrides(https_server, ca_cert_pem_file, backend):Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a
lines 44–46why, one step back44 """45 An HTTPS request, with SSL configuration set on the request.46 """Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 47why, one step back47 async with HTTPConnection(origin=https_server.url, backend=backend) as conn:Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 48why, one step back48 response = await conn.request("GET", https_server.url, verify=ca_cert_pem_file)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 49–51why, one step back49 await response.read()50 assert response.status_code == 20051 assert response.content == b"Hello, world!"