test_connections.py
This file
Path
tests/dispatch/test_connections.py
49 lines · 1.8 KiB · Python
Last changed by
Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
History of this fileTake it
The walk stopped after 200 commits: lines older than 20cb8af point at it.
Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
line 1why, one step back1import pytestTravis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
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 HTTPConnectionTravis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
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):Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 8why, one step back8 async with HTTPConnection(origin=server.url) as conn:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 9why, one step back9 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!"Travis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
lines 13–14why, one step back1314Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 15why, one step back15async def test_post(server, backend):Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 16why, one step back16 async with HTTPConnection(origin=server.url) as conn:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 17why, one step back17 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):Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 23why, one step back23 async with HTTPConnection(origin=server.url) as conn:Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87
lines 24–27why, one step back24 response = await conn.request(25 "GET", server.url.copy_with(path="/premature_close")26 )27 await response.read()Travis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
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):Travis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
lines 31–33why, one step back31 """32 An HTTPS request, with default SSL configuration set on the client.33 """Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 34why, one step back34 async with HTTPConnection(origin=https_server.url, verify=ca_cert_pem_file) as conn:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 35why, one step back35 response = await conn.request("GET", https_server.url)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 36–38why, one step back36 await response.read()37 assert response.status_code == 20038 assert response.content == b"Hello, world!"Travis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
lines 39–40why, one step back3940Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 41why, one step back41async def test_https_get_with_sll_overrides(https_server, ca_cert_pem_file, backend):Travis sudo no longer required for Xenial (#266)Hugo van Kemenadebefore adoption20cb8af
lines 42–44why, one step back42 """43 An HTTPS request, with SSL configuration set on the request.44 """Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 45why, one step back45 async with HTTPConnection(origin=https_server.url) as conn:Use a certificate issued from the trustme CA in tests (#357)Jamie Hewlandbefore adoption338a360
line 46why, one step back46 response = await conn.request("GET", https_server.url, verify=ca_cert_pem_file)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 47–49why, one step back47 await response.read()48 assert response.status_code == 20049 assert response.content == b"Hello, world!"