No project description provided
Project description
jj-district42
Installation
pip3 install jj-district42
Usage
import jj
import httpx
from jj.mock import mocked
from jj_district42 import HistorySchema
from valera import validate_or_fail
matcher = jj.match("GET", "/users")
response = jj.Response(status=200, json=[])
with mocked(matcher, response) as mock:
resp = httpx.get("http://localhost:8080/users", params={"user_id": 1})
assert validate_or_fail(
HistorySchema % [
{
"request": {
"method": "GET",
"path": "/users",
# equals (exact match)
"params": {"user_id": "1"},
},
"response": {
"status": 200,
# contains
"headers": [
...,
["Content-Type", "application/json"],
...
],
"body": b"[]",
}
}
],
mock.history
)
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
jj-district42-0.2.1.tar.gz
(16.9 kB
view hashes)
Built Distribution
Close
Hashes for jj_district42-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20c759baaf70ad2c4bcc60a1bcf44900991fc8ac814a029cbff538be31f6d299 |
|
MD5 | ad42fc4eaf6d9513fb463234a6c0f014 |
|
BLAKE2b-256 | 907528804977c0174edf80daa8b9bc47e8434f7e4d2e2f7166452d6390943c1a |