30 lines
797 B
Python
30 lines
797 B
Python
from pathlib import Path
|
|
|
|
import yaml
|
|
|
|
|
|
def test_openapi_31_exact_routes_and_responses() -> None:
|
|
document = yaml.safe_load(
|
|
(Path(__file__).parents[1] / "openapi.yaml").read_text(encoding="utf-8")
|
|
)
|
|
assert document["openapi"] == "3.1.0"
|
|
paths = document["paths"]
|
|
assert set(paths) == {
|
|
"/internal/safety/v2/messages/check",
|
|
"/internal/safety/v2/messages/tasks/{task_id}",
|
|
"/health/live",
|
|
"/health/ready",
|
|
}
|
|
assert set(paths["/internal/safety/v2/messages/check"]["post"]["responses"]) == {
|
|
"200",
|
|
"202",
|
|
"400",
|
|
"401",
|
|
"403",
|
|
"409",
|
|
"429",
|
|
"500",
|
|
"503",
|
|
}
|
|
assert document["components"]["securitySchemes"]["ServiceToken"]["name"] == "X-Service-Token"
|