mirror of
https://github.com/jmagar/unraid-mcp.git
synced 2026-03-02 00:04:45 -08:00
fix: address PR review threads - test assertions, ruff violations, format_kb consistency
Resolves review threads:
- PRRT_kwDOO6Hdxs5vNroH (Thread 36): tests now verify generic ToolError message
instead of raw exception text (security: no sensitive data in user-facing errors)
- PRRT_kwDOO6Hdxs5vNuYg (Thread 14): format_kb KB branch now uses :.2f like all
other branches (consistency fix)
- I001/F841/PERF401: fix ruff violations in http_layer, integration, safety tests
Changes:
- tests/test_array.py: match "Failed to execute array/parity_status" (not raw error)
- tests/test_keys.py: match "Failed to execute keys/list" (not raw error)
- tests/test_notifications.py: match "Failed to execute notifications/overview" (not raw error)
- tests/test_storage.py: update format_kb assertion to "512.00 KB" (:.2f format)
- tests/http_layer/test_request_construction.py: remove unused result var (F841)
+ fix import sort (I001)
- tests/safety/test_destructive_guards.py: use list.extend (PERF401) + fix import sort
- unraid_mcp/core/utils.py: format_kb returns f"{k:.2f} KB" for sub-MB values
Co-authored-by: @coderabbitai
Co-authored-by: @cubic-dev-ai
Co-authored-by: @copilot-pull-request-reviewer
This commit is contained in:
@@ -93,6 +93,14 @@ class TestStorageValidation:
|
||||
result = await tool_fn(action="logs", log_path="/var/log/syslog", tail_lines=10_000)
|
||||
assert result["content"] == "ok"
|
||||
|
||||
async def test_non_logs_action_ignores_tail_lines_validation(
|
||||
self, _mock_graphql: AsyncMock
|
||||
) -> None:
|
||||
_mock_graphql.return_value = {"shares": []}
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="shares", tail_lines=0)
|
||||
assert result["shares"] == []
|
||||
|
||||
|
||||
class TestFormatKb:
|
||||
def test_none_returns_na(self) -> None:
|
||||
@@ -102,7 +110,7 @@ class TestFormatKb:
|
||||
assert format_kb("not-a-number") == "N/A"
|
||||
|
||||
def test_kilobytes_range(self) -> None:
|
||||
assert format_kb(512) == "512 KB"
|
||||
assert format_kb(512) == "512.00 KB"
|
||||
|
||||
def test_megabytes_range(self) -> None:
|
||||
assert format_kb(2048) == "2.00 MB"
|
||||
|
||||
Reference in New Issue
Block a user