A utility for mocking out the Python httpx library.
Project description
respx
A utility for mocking out the Python httpx library.
import httpx
import respx
@respx.activate
def test_something():
request = respx.post("https://foo.bar/baz/", status_code=201)
response = httpx.post("https://foo.bar/baz/")
assert request.called
assert response.status_code == 201
with respx.activate():
request = respx.get("https://foo.bar/", content={"foo": "bar"})
response = httpx.get("https://foo.bar/")
assert request.called
assert response.json() == {"foo": "bar"}
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.4.tar.gz
(6.1 kB
view hashes)
Built Distribution
respx-0.4-py3-none-any.whl
(10.0 kB
view hashes)