coming together

This commit is contained in:
HotSwapp
2025-08-13 18:53:35 -05:00
parent acc5155bf7
commit 5111079149
51 changed files with 14457 additions and 588 deletions

25
tests/helpers.py Normal file
View File

@@ -0,0 +1,25 @@
def assert_validation_error(resp, field_name: str):
assert resp.status_code == 422
body = resp.json()
assert body.get("success") is False
assert body.get("error", {}).get("code") == "validation_error"
# Ensure correlation id is present and echoed in header
cid = body.get("correlation_id")
assert isinstance(cid, str) and cid
assert resp.headers.get("X-Correlation-ID") == cid
# Ensure the field appears in details
details = body.get("error", {}).get("details", [])
assert any(field_name in ":".join(map(str, err.get("loc", []))) for err in details)
def assert_http_error(resp, status_code: int, message_substr: str):
assert resp.status_code == status_code
body = resp.json()
assert body.get("success") is False
assert body.get("error", {}).get("code") == "http_error"
assert message_substr in body.get("error", {}).get("message", "")
cid = body.get("correlation_id")
assert isinstance(cid, str) and cid
assert resp.headers.get("X-Correlation-ID") == cid