This commit is contained in:
lda
2026-05-16 18:11:10 +07:00 Verified
parent 7dcfad92c1
commit cfca2547d5
7 changed files with 74 additions and 0 deletions
+10
View File
@@ -74,6 +74,7 @@ def test_create_broker_server_exposes_tools_resources_and_prompts() -> None:
assert "get_connection_statuses" in tool_names
assert "refresh_connection_catalog" in tool_names
assert "get_planner_catalog" in tool_names
assert "list_sources" in tool_names
assert "list_spec_sources" in tool_names
assert "invoke_broker_method" in tool_names
assert "call_broker_tool" in tool_names
@@ -101,6 +102,15 @@ def test_create_broker_server_exposes_tools_resources_and_prompts() -> None:
assert "wf.mcp" in source_ids
assert "wf.std" in source_ids
_content, all_sources_payload_raw = asyncio.run(
server.call_tool("list_sources", {})
)
all_sources_payload = cast(dict[str, Any], cast(object, all_sources_payload_raw))
all_sources = all_sources_payload["result"]
all_source_ids = {source["id"] for source in all_sources}
assert "wf.admin" in all_source_ids
assert "demo.personal" in all_source_ids
def test_broker_admin_tools_are_backed_by_wf_admin_source() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "broker_admin_source"))
+18
View File
@@ -98,6 +98,24 @@ def test_service_installs_builtin_stdlib_specs_by_default() -> None:
assert all(source["kind"] == "system" for source in sources)
def test_service_lists_all_capability_sources_with_owned_capability_names() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "source_inventory"))
sources = service.list_sources()
sources_by_id = {source["id"]: source for source in sources}
std_source = sources_by_id["wf.std"]
assert "wf.std.runtime_error" in std_source["capabilities"]["node_specs"]
assert std_source["capabilities"]["tools"] == []
mcp_source = sources_by_id["wf.mcp"]
assert mcp_source["capabilities"]["node_specs"] == ["wf.mcp.call_tool"]
admin_source = sources_by_id["wf.admin"]
assert admin_source["visibility"]["planner"] is False
assert "wf.admin.list_sources" in admin_source["capabilities"]["tools"]
def test_wf_std_source_contains_authoring_ops() -> None:
service = WfMcpService(store=FileStore(local_temp_root() / "stdlib_source_store"))
specs = service.capability_sources["wf.std"].capabilities.node_specs