Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/integration/test_openapi_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,19 @@ def _check_server_section_present(spec: dict[str, Any]) -> None:


def _check_paths_and_responses_exist(
spec: dict, path: str, method: str, expected_codes: set[str]
spec: dict[str, Any], path: str, method: str, expected_codes: set[str]
) -> None:
"""Checks if the specified paths and responses exist in the API specification.

Args:
spec (dict): The API specification.
path (str): The API endpoint path to check.
method (str): The HTTP method to check.
expected_codes (set[str]): The set of expected HTTP status codes.

Raises:
AssertionError: If the path, method, or any of the expected response codes are missing.
"""
paths = spec.get("paths") or {}
assert path in paths, f"Missing path: {path}"
op = (paths[path] or {}).get(method)
Expand Down
Loading