A utility for mocking out the Python httpx library.
Project description
responsex
A utility for mocking out the Python httpx library.
import httpx
import responsex
with responsex.activate():
responsex.add("GET", "https://foo.bar/", content={"foo": "bar"})
response = httpx.get("https://foo.bar/")
assert response.json() == {"foo": "bar"}
@responsex.activate
def test_something():
responsex.add("POST", "https://foo.bar/baz/", status_code=201)
response = httpx.post("https://foo.bar/baz/")
assert response.status_code == 201
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
respx-0.3.1.tar.gz
(5.9 kB
view hashes)
Built Distribution
respx-0.3.1-py3-none-any.whl
(5.8 kB
view hashes)