pytest fixture for HTTPX
Project description
pytest fixture for HTTPX
This module is still under development and cannot be considered stable.
Use pytest_httpx.httpx_mock
pytest
fixture to mock httpx
requests.
Add responses
import httpx
from pytest_httpx import httpx_mock, HTTPXMock
def test_something(httpx_mock: HTTPXMock):
httpx_mock.add_response("http://test_url")
response = httpx.get("http://test_url")
If all responses are not sent back during test execution, the test case will fail.
Check sent requests
import httpx
from pytest_httpx import httpx_mock, HTTPXMock
def test_something(httpx_mock: HTTPXMock):
httpx_mock.add_response("http://test_url")
response = httpx.get("http://test_url")
# requests are in httpx_mock.requests
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
pytest_httpx-0.0.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for pytest_httpx-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af6c32a86017eb4b701cc6f5cd8dc843336e479a9164059a6dfbf9536e7427f7 |
|
MD5 | 7f619b7177d678720e8709f6f0c8504c |
|
BLAKE2b-256 | 0e8e00159fef20086d3f0b1b78f2a42bed03d4e8b2b84b04a4d0a15f48fdcf1f |