fmt
This commit is contained in:
@@ -84,13 +84,15 @@ class FakeManager:
|
||||
metadata: dict[str, Any] | None = None,
|
||||
enabled: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
self.added.append({
|
||||
"connection_id": connection_id,
|
||||
"server": server,
|
||||
"account": account,
|
||||
"metadata": metadata,
|
||||
"enabled": enabled,
|
||||
})
|
||||
self.added.append(
|
||||
{
|
||||
"connection_id": connection_id,
|
||||
"server": server,
|
||||
"account": account,
|
||||
"metadata": metadata,
|
||||
"enabled": enabled,
|
||||
}
|
||||
)
|
||||
return {"action": "add_connection", "ok": True}
|
||||
|
||||
def update_connection(
|
||||
|
||||
+78
-64
@@ -14,29 +14,33 @@ from .test_support import local_temp_root
|
||||
|
||||
def _write_config(path: Path) -> None:
|
||||
path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
}
|
||||
],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def test_build_parser_accepts_serve_transport() -> None:
|
||||
parser = build_parser()
|
||||
args = parser.parse_args([
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--transport",
|
||||
"streamable_http",
|
||||
])
|
||||
args = parser.parse_args(
|
||||
[
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--transport",
|
||||
"streamable_http",
|
||||
]
|
||||
)
|
||||
|
||||
assert args.command == "serve"
|
||||
assert args.transport == "streamable_http"
|
||||
@@ -47,15 +51,17 @@ def test_build_parser_accepts_serve_transport() -> None:
|
||||
|
||||
def test_build_parser_accepts_proxy_compatibility_flags() -> None:
|
||||
parser = build_parser()
|
||||
args = parser.parse_args([
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--resources-as-tools",
|
||||
"--prompts-as-tools",
|
||||
"--search-tools",
|
||||
"--safe-tool-names",
|
||||
])
|
||||
args = parser.parse_args(
|
||||
[
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--resources-as-tools",
|
||||
"--prompts-as-tools",
|
||||
"--search-tools",
|
||||
"--safe-tool-names",
|
||||
]
|
||||
)
|
||||
|
||||
assert args.command == "serve"
|
||||
assert args.resources_as_tools is True
|
||||
@@ -68,23 +74,27 @@ def test_build_parser_rejects_legacy_mode_flag() -> None:
|
||||
parser = build_parser()
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
parser.parse_args([
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--mode",
|
||||
"unified",
|
||||
])
|
||||
parser.parse_args(
|
||||
[
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--mode",
|
||||
"unified",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def test_build_parser_accepts_no_admin_tools_flag() -> None:
|
||||
parser = build_parser()
|
||||
args = parser.parse_args([
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--no-admin-tools",
|
||||
])
|
||||
args = parser.parse_args(
|
||||
[
|
||||
"--config",
|
||||
"wf_mcp.config.json",
|
||||
"serve",
|
||||
"--no-admin-tools",
|
||||
]
|
||||
)
|
||||
|
||||
assert args.command == "serve"
|
||||
assert args.admin_tools is False
|
||||
@@ -154,21 +164,23 @@ def test_load_broker_config_normalizes_typed_stdio_metadata() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
"metadata": {
|
||||
"command": "python",
|
||||
"args": ["server.py"],
|
||||
"env": {"TOKEN": "secret"},
|
||||
},
|
||||
}
|
||||
],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
"metadata": {
|
||||
"command": "python",
|
||||
"args": ["server.py"],
|
||||
"env": {"TOKEN": "secret"},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
@@ -188,16 +200,18 @@ def test_load_broker_config_rejects_bad_metadata_shape() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
"metadata": {"transport": "stdio", "args": "server.py"},
|
||||
}
|
||||
],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"id": "demo.personal",
|
||||
"server": "demo",
|
||||
"account": "personal",
|
||||
"metadata": {"transport": "stdio", "args": "server.py"},
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
@@ -38,9 +38,7 @@ def test_mcp_workflow_surface_example_runs_happy_path(tmp_path) -> None:
|
||||
assert payload["diagnostics"] == []
|
||||
|
||||
|
||||
def test_mcp_wrapper_authoring_flow_example_creates_and_calls_wrapper(tmp_path) -> (
|
||||
None
|
||||
):
|
||||
def test_mcp_wrapper_authoring_flow_example_creates_and_calls_wrapper(tmp_path) -> None:
|
||||
payload = asyncio.run(author_echo_wrapper_from_capability(tmp_path))
|
||||
|
||||
assert payload["inspected_hints"]["capability_name"] == "demo.personal.echo_tool"
|
||||
|
||||
+31
-23
@@ -389,17 +389,19 @@ def test_proxy_admin_tools_mutate_config_file() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "fixture.personal",
|
||||
"server": "fixture",
|
||||
"account": "personal",
|
||||
"enabled": False,
|
||||
}
|
||||
],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [
|
||||
{
|
||||
"id": "fixture.personal",
|
||||
"server": "fixture",
|
||||
"account": "personal",
|
||||
"enabled": False,
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_broker_config(config_path)
|
||||
@@ -484,10 +486,12 @@ def test_proxy_admin_reload_remounts_connections() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_broker_config(config_path)
|
||||
@@ -544,10 +548,12 @@ def test_proxy_admin_reload_sends_list_changed_notifications() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_broker_config(config_path)
|
||||
@@ -576,10 +582,12 @@ def test_proxy_config_mutation_does_not_notify_before_reload() -> None:
|
||||
tmp_path.mkdir(parents=True, exist_ok=True)
|
||||
config_path = tmp_path / "wf_mcp.config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}),
|
||||
json.dumps(
|
||||
{
|
||||
"store_root": ".wf_mcp_store",
|
||||
"connections": [],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_broker_config(config_path)
|
||||
|
||||
@@ -65,9 +65,11 @@ def test_rewrites_resource_links_inside_call_tool_result() -> None:
|
||||
|
||||
def _resource_link(uri: str) -> mcp_types.ResourceLink:
|
||||
"""Build ResourceLink through validation because Pydantic accepts URI strings."""
|
||||
return mcp_types.ResourceLink.model_validate({
|
||||
"type": "resource_link",
|
||||
"name": "dynamic-text",
|
||||
"uri": uri,
|
||||
"mimeType": "text/plain",
|
||||
})
|
||||
return mcp_types.ResourceLink.model_validate(
|
||||
{
|
||||
"type": "resource_link",
|
||||
"name": "dynamic-text",
|
||||
"uri": uri,
|
||||
"mimeType": "text/plain",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -133,13 +133,15 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
assert "workspace_id" in create_workspace_schema["properties"]
|
||||
assert "revision" in create_workspace_schema["properties"]
|
||||
list_sources_schema = tools_by_name["wf.admin.list_sources"].inputSchema
|
||||
assert "inspect_source" in list_sources_schema["properties"]["limit"][
|
||||
"description"
|
||||
]
|
||||
assert (
|
||||
"inspect_source"
|
||||
in list_sources_schema["properties"]["limit"]["description"]
|
||||
)
|
||||
inspect_source_schema = tools_by_name["wf.admin.inspect_source"].inputSchema
|
||||
assert "Exact source id" in inspect_source_schema["properties"][
|
||||
"source_id"
|
||||
]["description"]
|
||||
assert (
|
||||
"Exact source id"
|
||||
in inspect_source_schema["properties"]["source_id"]["description"]
|
||||
)
|
||||
minimal_workspace_input = tools_by_name[
|
||||
"wf.workflow.create_minimal_draft_workspace"
|
||||
].inputSchema
|
||||
@@ -399,9 +401,7 @@ def test_workflow_tools_have_human_metadata() -> None:
|
||||
assert run_deployment.title == "Run Workflow Deployment"
|
||||
assert "deployment_id" in (run_deployment.description or "")
|
||||
assert "trace_range" in run_deployment.inputSchema["properties"]
|
||||
trace_range_schema = run_deployment.inputSchema["properties"][
|
||||
"trace_range"
|
||||
]
|
||||
trace_range_schema = run_deployment.inputSchema["properties"]["trace_range"]
|
||||
assert "Debug traces" in trace_range_schema.get("description", "")
|
||||
assert "null" in [
|
||||
option.get("type") for option in trace_range_schema["anyOf"]
|
||||
|
||||
@@ -284,9 +284,7 @@ def test_workflow_surface_lists_compact_deployment_summaries_and_inspects_detail
|
||||
artifact_store.save_deployment(deployment)
|
||||
|
||||
listed = asyncio.run(handlers.list_deployments())
|
||||
inspected = asyncio.run(
|
||||
handlers.inspect_deployment(deployment_id="echo.personal")
|
||||
)
|
||||
inspected = asyncio.run(handlers.inspect_deployment(deployment_id="echo.personal"))
|
||||
|
||||
assert listed["deployments"][0]["id"] == "echo.personal"
|
||||
assert listed["deployments"][0]["binding_count"] == 1
|
||||
|
||||
Reference in New Issue
Block a user