19 lines
606 B
Python
19 lines
606 B
Python
import schemathesis
|
|
|
|
schema = schemathesis.openapi.from_path("../../../misc/BreCalApi.yaml")
|
|
|
|
@schema.parametrize()
|
|
def test_api_conformance(
|
|
case,
|
|
base_url: str,
|
|
auth_headers: dict[str, str],
|
|
login_payload: dict[str, str],
|
|
) -> None:
|
|
# Calls your real service:
|
|
if case.path == "/login" and case.method.upper() == "POST":
|
|
response = case.call(base_url=base_url, json=login_payload)
|
|
else:
|
|
response = case.call(base_url=base_url, headers=auth_headers)
|
|
# Validates status code, headers, and body against the OpenAPI schema:
|
|
case.validate_response(response)
|