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.mock
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.mock():
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.7.tar.gz
(6.5 kB
view hashes)
Built Distribution
respx-0.7-py3-none-any.whl
(10.6 kB
view hashes)