the start of the merge
This commit is contained in:
@@ -64,6 +64,22 @@ def test_build_parser_accepts_proxy_compatibility_flags() -> None:
|
||||
assert args.search_tools is True
|
||||
|
||||
|
||||
def test_build_parser_accepts_unified_mode() -> None:
|
||||
parser = build_parser()
|
||||
args = parser.parse_args(
|
||||
[
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--mode",
|
||||
"unified",
|
||||
]
|
||||
)
|
||||
|
||||
assert args.command == "serve"
|
||||
assert args.mode == "unified"
|
||||
|
||||
|
||||
def test_cli_connections_prints_configured_connections(capsys) -> None:
|
||||
tmp_path = local_temp_root() / "cli_connections_test"
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
from wf_mcp.models import BrokerConfig, ConnectionConfig
|
||||
from wf_mcp.server import create_unified_proxy_client
|
||||
|
||||
from .test_support import fixture_server_path, local_temp_root
|
||||
|
||||
|
||||
def _structured(result: Any) -> dict[str, Any]:
|
||||
content = result.structured_content
|
||||
assert isinstance(content, dict)
|
||||
return content
|
||||
|
||||
|
||||
def test_unified_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
config = BrokerConfig(
|
||||
store_root=local_temp_root() / "unified_server_store",
|
||||
connections=[
|
||||
ConnectionConfig(
|
||||
id="fixture.personal",
|
||||
server="fixture",
|
||||
account="personal",
|
||||
metadata={
|
||||
"transport": "stdio",
|
||||
"command": sys.executable,
|
||||
"args": [fixture_server_path()],
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
async def run_proxy() -> None:
|
||||
client = create_unified_proxy_client(config)
|
||||
async with client:
|
||||
tools = await client.list_tools()
|
||||
names = [tool.name for tool in tools]
|
||||
assert "fixture.personal_echo_tool" in names
|
||||
assert "wf.admin.list_connections" in names
|
||||
assert "wf.workflow.list_artifacts" in names
|
||||
assert "wf.workflow.run_deployment" in names
|
||||
|
||||
echo_result = await client.call_tool(
|
||||
"fixture.personal_echo_tool",
|
||||
{"text": "hello"},
|
||||
)
|
||||
artifacts_result = await client.call_tool("wf.workflow.list_artifacts")
|
||||
|
||||
assert _structured(echo_result)["echoed"] == "hello"
|
||||
assert _structured(artifacts_result)["nodes"] == []
|
||||
|
||||
asyncio.run(run_proxy())
|
||||
Reference in New Issue
Block a user