mirror of
https://github.com/jmagar/unraid-mcp.git
synced 2026-03-23 12:39:24 -07:00
fix(lint): remove __future__ annotations from new tools, fix 4 failing tests
- Remove `from __future__ import annotations` from array.py, live.py,
oidc.py, plugins.py to match existing tool pattern and resolve TC002
ruff errors (fastmcp imports only needed in annotations under PEP 563)
- Add `# noqa: ASYNC109` to live.py timeout parameter (asyncio.timeout
already used internally)
- Fix test_network_sends_correct_query: query name is GetNetworkInfo
- Fix test_delete_requires_confirm: match "not confirmed" not "destructive"
- Fix test_destructive_set_matches_audit[settings]: add setup_remote_access
and enable_dynamic_remote_access to KNOWN_DESTRUCTIVE
- Fix test_logs: update mock to dict format {lines: [{timestamp, message}]}
742 tests passing, ruff clean
This commit is contained in:
@@ -304,7 +304,7 @@ class TestInfoToolRequests:
|
||||
tool = self._get_tool()
|
||||
await tool(action="network")
|
||||
body = _extract_request_body(route.calls.last.request)
|
||||
assert "GetNetworkConfig" in body["query"]
|
||||
assert "GetNetworkInfo" in body["query"]
|
||||
|
||||
@respx.mock
|
||||
async def test_metrics_sends_correct_query(self) -> None:
|
||||
@@ -1177,7 +1177,7 @@ class TestKeysToolRequests:
|
||||
@respx.mock
|
||||
async def test_delete_requires_confirm(self) -> None:
|
||||
tool = self._get_tool()
|
||||
with pytest.raises(ToolError, match="destructive"):
|
||||
with pytest.raises(ToolError, match="not confirmed"):
|
||||
await tool(action="delete", key_id="k1")
|
||||
|
||||
@respx.mock
|
||||
|
||||
@@ -89,7 +89,7 @@ KNOWN_DESTRUCTIVE: dict[str, dict[str, set[str] | str]] = {
|
||||
"module": "unraid_mcp.tools.settings",
|
||||
"register_fn": "register_settings_tool",
|
||||
"tool_name": "unraid_settings",
|
||||
"actions": {"configure_ups"},
|
||||
"actions": {"configure_ups", "setup_remote_access", "enable_dynamic_remote_access"},
|
||||
"runtime_set": SETTINGS_DESTRUCTIVE,
|
||||
},
|
||||
"plugins": {
|
||||
|
||||
@@ -209,7 +209,15 @@ class TestDockerActions:
|
||||
cid = "a" * 64 + ":local"
|
||||
_mock_graphql.side_effect = [
|
||||
{"docker": {"containers": [{"id": cid, "names": ["plex"]}]}},
|
||||
{"docker": {"logs": "2026-02-08 log line here"}},
|
||||
{
|
||||
"docker": {
|
||||
"logs": {
|
||||
"containerId": cid,
|
||||
"lines": [{"timestamp": "2026-02-08", "message": "log line here"}],
|
||||
"cursor": None,
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="logs", container_id="plex")
|
||||
|
||||
Reference in New Issue
Block a user