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 details)
Built Distribution
File details
Details for the file pytest_httpx-0.0.1.tar.gz
.
File metadata
- Download URL: pytest_httpx-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d7431dc30637a00f1f0afa95713ca73a022b7f53ac6f8a00b5679baaf6a0a6cd
|
|
MD5 |
a478387c65d2bc76d8f70f52d063cf1a
|
|
BLAKE2b-256 |
9e563771603c1636b38e89be8d26cd12dc032b0db7f9487ee87e38293292f2fe
|
File details
Details for the file pytest_httpx-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_httpx-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
af6c32a86017eb4b701cc6f5cd8dc843336e479a9164059a6dfbf9536e7427f7
|
|
MD5 |
7f619b7177d678720e8709f6f0c8504c
|
|
BLAKE2b-256 |
0e8e00159fef20086d3f0b1b78f2a42bed03d4e8b2b84b04a4d0a15f48fdcf1f
|