Files
inecs 6033967e6a Initial commit: stateful OpenStack API laboratory simulator.
Ship Keystone auth, multi-service handlers (Yoga→Dalmatian), Compose/Helm
packaging, API contract packs, and pytest/Pulumi coverage labs.
2026-07-18 04:26:48 +03:00

26 lines
839 B
Python

"""Tests for contract example generation."""
from app.contracts.examples import path_param_example, schema_example
from app.contracts.model import Schema
def test_path_param_examples_use_known_placeholders() -> None:
assert path_param_example("node") == "pve01"
assert path_param_example("vmid") == 100
def test_schema_example_prefers_default_and_enum() -> None:
assert schema_example(Schema(type="string", default="custom")) == "custom"
assert schema_example(Schema(type="string", enum=("a", "b"))) == "a"
def test_schema_example_builds_object_and_array() -> None:
schema = Schema(
type="object",
properties={
"count": Schema(type="integer", minimum=2),
"enabled": Schema(type="boolean", optional=True),
},
)
assert schema_example(schema) == {"count": 2}