test_connections.py
This file
Path
tests/dispatch/test_connections.py
20 lines · 568 bytes · Python
Last changed by
Response.contentTom Christiebefore adoption4c55113
History of this fileTake it
Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 1–10why, one step back1import pytest23import httpcore456@pytest.mark.asyncio7async def test_get(server):8 http = httpcore.HTTPConnection(origin="http://127.0.0.1:8000/")9 response = await http.request("GET", "http://127.0.0.1:8000/")10 assert response.status_code == 200Response.contentTom Christiebefore adoption4c55113
line 11why, one step back11 assert response.content == b"Hello, world!"Rejig test and tighten up models APITom Christiebefore adoptiondea4d42
lines 12–20why, one step back121314@pytest.mark.asyncio15async def test_post(server):16 http = httpcore.HTTPConnection(origin="http://127.0.0.1:8000/")17 response = await http.request(18 "POST", "http://127.0.0.1:8000/", body=b"Hello, world!"19 )20 assert response.status_code == 200