Files
pyMC_Repeater/tests/test_openapi_identity_contract.py
2026-06-09 16:10:37 -04:00

22 lines
770 B
Python

from pathlib import Path
import yaml
def test_create_identity_schema_matches_supported_identity_types():
spec_path = Path(__file__).parents[1] / "repeater" / "web" / "openapi.yaml"
spec = yaml.safe_load(spec_path.read_text(encoding="utf-8"))
schema = spec["paths"]["/create_identity"]["post"]["requestBody"]["content"][
"application/json"
]["schema"]
properties = schema["properties"]
assert properties["type"]["enum"] == ["companion", "room_server"]
assert {"node_name", "tcp_port", "bind_address"} <= set(properties["settings"]["properties"])
assert set(
spec["paths"]["/create_identity"]["post"]["requestBody"]["content"]["application/json"][
"examples"
]
) == {"companion", "room_server"}