Skip to main content

A utility for mocking out the Python httpx library.

Project description

responsex

codecov PyPi Version Python Versions

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


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)

Uploaded Source

Built Distribution

respx-0.3.1-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page