Skip to content
Myr

Additional tests for SyncClient

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yeray Diaz Diaz · committed by Yeray Diaz Diaz · parent f1b10e5 · Browse files · 1 file+46 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+46 added−0 removed

  • tests:+46 added−0 removed

1 file+46 added−0 removed

modified:tests/client/test_client.py+46 added
28 unmodified lines
29 response = http.get("http://127.0.0.1:8000/")30 assert response.status_code == 20031 assert response.content == b"Hello, world!"32 assert response.text == "Hello, world!"33 assert response.protocol == "HTTP/1.1"34 assert response.headers35 assert repr(response) == "<SyncResponse(status_code=200)>"363738@threadpool39def test_post(server):
31 unmodified lines
71 body = b""72 for chunk in response.raw():73 body += chunk74 assert body == b"Hello, world!"75 response.close() # TODO: should Response be available as context managers?767778@threadpool79def test_options(server):80 with httpcore.SyncClient() as http:81 response = http.options("http://127.0.0.1:8000/")8283 assert response.status_code == 20084 assert response.reason_phrase == "OK"858687@threadpool88def test_head(server):89 with httpcore.SyncClient() as http:90 response = http.head("http://127.0.0.1:8000/")9192 assert response.status_code == 20093 assert response.reason_phrase == "OK"949596@threadpool97def test_put(server):98 with httpcore.SyncClient() as http:99 response = http.put("http://127.0.0.1:8000/", data=b"Hello, world!")100 assert response.status_code == 200101 assert response.reason_phrase == "OK"102103104@threadpool105def test_patch(server):106 with httpcore.SyncClient() as http:107 response = http.patch("http://127.0.0.1:8000/", data=b"Hello, world!")108 assert response.status_code == 200109 assert response.reason_phrase == "OK"110111112@threadpool113def test_delete(server):114 with httpcore.SyncClient() as http:115 response = http.delete("http://127.0.0.1:8000/")116 assert response.status_code == 200117 assert response.reason_phrase == "OK"