test_wp09_runtime_api_contract.py 928 B

1234567891011121314151617181920
  1. from pathlib import Path
  2. ROOT = Path(__file__).resolve().parents[1]
  3. def test_wp09_runtime_api_is_authenticated_no_store_and_rejects_client_scope():
  4. source = (ROOT / "app/api/knowledge_base/agent_governance_routes.py").read_text(encoding="utf-8")
  5. repository = (ROOT / "app/core/llm/runtime_governance_repository.py").read_text(encoding="utf-8")
  6. assert '/agents/<agent_uid>/runtime/invocations' in source
  7. assert "X-Agent-Credential" in source
  8. assert "validate_credential(agent_uid, token)" in source
  9. assert "RuntimeServerContext" in source
  10. assert "_no_store" in source
  11. assert "ServerGovernedInvocationService" in source
  12. assert "grant_context" in repository
  13. assert "agent_runtime_authorize" in repository
  14. assert "SET LOCAL ROLE dataops_agent_runtime" in repository
  15. assert "/runtime/invocations/<idempotency_key>/settle" in source
  16. assert "settle_runtime_invocation" in source