777926487b
initial QEMU slice, backed by imported contracts for majors 6–9. - Implement durable handlers for access/auth, cluster, LXC, storage, HA, firewall, Ceph, SDN, ACME, notifications, pools, mapping, and node ops - Serve an interactive Web UI with catalog browsing, demo seed controls, and OpenAPI/help surfaces - Bundle PVE 6.4-15, 7.4-16, and 8.4.5 contract revisions alongside 9.2.3 - Support in-memory runtime contract Apply (POST /ui/api/contract/apply) so /version and /api2 routes follow the selected major until restart - Expand seed profiles (including demo-cluster), migrations 007–008, TLS gateway config, Compose/Makefile tooling, and compatibility evidence - Tighten .gitignore for macOS, hidden directories (.*/), and local secrets
26 lines
839 B
Python
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}
|