Skip to content
Myr

test_connections.py

This file

Path

tests/dispatch/test_connections.py

44 lines · 1.5 KiB · Python

Last changed by

SSLConfig refactor (#706)Tom Christiebefore adoptionb0bf2a7

History of this file

Take it

The walk stopped after 200 commits: lines older than 8155352 point at it.

Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87

line 1why, one step back
1import pytest

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 2why, one step back
2

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 3why, one step back
3import httpx

SSLConfig refactor (#706)Tom Christiebefore adoptionb0bf2a7

line 4why, one step back
4from httpx.config import SSLConfig

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 5why, one step back
5from httpx.dispatch.connection import HTTPConnection

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 6why, one step back
6

Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87

line 7why, one step back
7

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 8–9why, one step back
8@pytest.mark.usefixtures("async_environment")
9async def test_get(server):

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 10why, one step back
10 async with HTTPConnection(origin=server.url) as conn:

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 11why, one step back
11 response = await conn.request("GET", server.url)

Rename 'read/close' to 'aread/aclose' on Response (#674)Florimond Mancabefore adoptionf9d18a8

line 12why, one step back
12 await response.aread()

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

lines 13–16why, one step back
13 assert response.status_code == 200
14 assert response.content == b"Hello, world!"1516

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 17–18why, one step back
17@pytest.mark.usefixtures("async_environment")
18async def test_post(server):

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 19why, one step back
19 async with HTTPConnection(origin=server.url) as conn:

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

lines 20–21why, one step back
20 response = await conn.request("GET", server.url, data=b"Hello, world!")
21 assert response.status_code == 200

Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87

lines 22–23why, one step back
22
23

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 24–25why, one step back
24@pytest.mark.usefixtures("async_environment")
25async def test_premature_close(server):

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 26why, one step back
26 with pytest.raises(httpx.ConnectionClosed):

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 27why, one step back
27 async with HTTPConnection(origin=server.url) as conn:

Handle h11.Connection.next_event() RemoteProtocolError (#524)toppkbefore adoptionf06ca87

lines 28–30why, one step back
28 response = await conn.request(
29 "GET", server.url.copy_with(path="/premature_close")30 )

Rename 'read/close' to 'aread/aclose' on Response (#674)Florimond Mancabefore adoptionf9d18a8

line 31why, one step back
31 await response.aread()

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

lines 32–33why, one step back
32
33

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

line 34why, one step back
34@pytest.mark.usefixtures("async_environment")

Drop per-request `cert`, `verify`, and `trust_env` (#617)Florimond Mancabefore adoptione9ebd1d

line 35why, one step back
35async def test_https_get_with_ssl(https_server, ca_cert_pem_file):

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 36why, one step back
36 """

Drop per-request `cert`, `verify`, and `trust_env` (#617)Florimond Mancabefore adoptione9ebd1d

line 37why, one step back
37 An HTTPS request, with SSL configuration set on the client.

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 38why, one step back
38 """

SSLConfig refactor (#706)Tom Christiebefore adoptionb0bf2a7

lines 39–40why, one step back
39 ssl = SSLConfig(verify=ca_cert_pem_file)
40 async with HTTPConnection(origin=https_server.url, ssl=ssl) as conn:

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

line 41why, one step back
41 response = await conn.request("GET", https_server.url)

Rename 'read/close' to 'aread/aclose' on Response (#674)Florimond Mancabefore adoptionf9d18a8

line 42why, one step back
42 await response.aread()

Document digest auth (#348)Yeray Diaz Diazbefore adoption8155352

lines 43–44why, one step back
43 assert response.status_code == 200
44 assert response.content == b"Hello, world!"