This commit is contained in:
1 parent
4db3f45164
commit
d25c04cdd2
175 files changed
+56243
-15
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from gewu.domain.operations import OPERATIONS, Transport, catalog_bytes, operations_for
|
||||
|
||||
|
||||
def test_read_http_catalog_contains_no_mutation_operations() -> None:
|
||||
http_operations = operations_for(Transport.HTTP)
|
||||
assert all(not operation.mutates_knowledge for operation in http_operations)
|
||||
assert not {"proposal_submit", "owner_decide"} & {item.name for item in http_operations}
|
||||
|
||||
|
||||
def test_owner_decision_is_separate_from_agent_mcp() -> None:
|
||||
agent_operations = {item.name for item in operations_for(Transport.MCP)}
|
||||
owner_operations = {item.name for item in operations_for(Transport.OWNER_MCP)}
|
||||
assert "owner_decide" not in agent_operations
|
||||
assert owner_operations == {"owner_challenge_get", "owner_diff_get", "owner_decide"}
|
||||
|
||||
|
||||
def test_stdio_connector_has_only_selected_file_operations() -> None:
|
||||
stdio_operations = {item.name for item in operations_for(Transport.STDIO)}
|
||||
assert stdio_operations == {"list_selected_files", "upload_selected_file"}
|
||||
|
||||
|
||||
def test_exported_catalog_matches_the_application_allowlist() -> None:
|
||||
path = Path(__file__).resolve().parents[2] / "schema" / "v1" / "catalog.json"
|
||||
catalog = json.loads(path.read_text(encoding="utf-8"))
|
||||
assert path.read_bytes() == catalog_bytes()
|
||||
names_by_transport = {
|
||||
transport.value: {operation.name for operation in operations_for(transport)}
|
||||
for transport in Transport
|
||||
}
|
||||
entries = {operation["name"]: operation for operation in catalog["operations"]}
|
||||
assert set(entries) == {operation.name for operation in OPERATIONS}
|
||||
for name, entry in entries.items():
|
||||
assert set(entry["transports"]) == {
|
||||
transport for transport, names in names_by_transport.items() if name in names
|
||||
}
|
||||
expected_mutates = next(item.mutates_knowledge for item in OPERATIONS if item.name == name)
|
||||
assert entry["mutates_knowledge"] is expected_mutates
|
||||
Reference in new issue
Block a user