Skip to content
Myr

test_connections.py

This file

Path

tests/test_connections.py

20 lines · 569 bytes · Python

Last changed by

Merge pull request #15 from encode/module-renamingTom Christiebefore adoption0c20fba

History of this file

Take it

Merge pull request #12 from encode/refactorTom Christiebefore adoption39eb55b

lines 1–7why, one step back
1import pytest
23import httpcore456@pytest.mark.asyncio7async def test_get(server):

Merge pull request #15 from encode/module-renamingTom Christiebefore adoption0c20fba

line 8why, one step back
8 http = httpcore.HTTP11Connection(origin="http://127.0.0.1:8000/")

Merge pull request #12 from encode/refactorTom Christiebefore adoption39eb55b

lines 9–15why, one step back
9 response = await http.request("GET", "http://127.0.0.1:8000/")
10 assert response.status_code == 20011 assert response.body == b"Hello, world!"121314@pytest.mark.asyncio15async def test_post(server):

Merge pull request #15 from encode/module-renamingTom Christiebefore adoption0c20fba

line 16why, one step back
16 http = httpcore.HTTP11Connection(origin="http://127.0.0.1:8000/")

Merge pull request #12 from encode/refactorTom Christiebefore adoption39eb55b

lines 17–20why, one step back
17 response = await http.request(
18 "POST", "http://127.0.0.1:8000/", body=b"Hello, world!"19 )20 assert response.status_code == 200