17 lines
616 B
Python
17 lines
616 B
Python
import time
|
|
|
|
from nova_plan.contracts import ContractRegistry
|
|
|
|
|
|
def test_registry_schema_and_validation():
|
|
# Retrieve the PlanDelta schema and validate a compliant payload
|
|
schema = ContractRegistry.get_schema("PlanDelta", 1)
|
|
assert schema is not None
|
|
|
|
payload = {"agent_id": "A1", "delta": {"x": 1.0}, "timestamp": time.time()}
|
|
assert ContractRegistry.validate_against_schema(payload, schema) is True
|
|
|
|
# Missing a required field should fail validation
|
|
bad_payload = {"agent_id": "A1", "delta": {"x": 1.0}}
|
|
assert ContractRegistry.validate_against_schema(bad_payload, schema) is False
|