forked from HomeLab/unraid-mcp
fix: address PR review comments on test suite
- Rename test_start_http_401_unauthorized to test_list_http_401_unauthorized to match the actual action="list" being tested (threads #19, #23) - Use consistent PrefixedID format ("a"*64+":local") in test_start_container instead of "abc123def456"*4 concatenation (thread #37) - Refactor container_actions_require_id to use @pytest.mark.parametrize so each action runs independently (thread #18) - Fix docstring claiming ToolError for test that asserts success in test_stop_mutation_returns_null (thread #26) - Fix inaccurate comment about `in` operator checking truthiness; it checks key existence (thread #25) - Add edge case tests for temperature=0, temperature=null, and logFile=null in test_storage.py (thread #31) Resolves review threads: PRRT_kwDOO6Hdxs5uvO2-, PRRT_kwDOO6Hdxs5uvOcf, PRRT_kwDOO6Hdxs5uu7zx, PRRT_kwDOO6Hdxs5uvO28, PRRT_kwDOO6Hdxs5uvOcp, PRRT_kwDOO6Hdxs5uvOcn, PRRT_kwDOO6Hdxs5uvKr3
This commit is contained in:
@@ -109,6 +109,45 @@ class TestStorageActions:
|
||||
assert result["summary"]["temperature"] == "35\u00b0C"
|
||||
assert "1.00 GB" in result["summary"]["size_formatted"]
|
||||
|
||||
async def test_disk_details_temperature_zero(self, _mock_graphql: AsyncMock) -> None:
|
||||
"""Temperature of 0 should display as '0\u00b0C', not 'N/A'."""
|
||||
_mock_graphql.return_value = {
|
||||
"disk": {
|
||||
"id": "d:1",
|
||||
"device": "sda",
|
||||
"name": "WD",
|
||||
"serialNum": "SN1",
|
||||
"size": 1073741824,
|
||||
"temperature": 0,
|
||||
}
|
||||
}
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="disk_details", disk_id="d:1")
|
||||
assert result["summary"]["temperature"] == "0\u00b0C"
|
||||
|
||||
async def test_disk_details_temperature_null(self, _mock_graphql: AsyncMock) -> None:
|
||||
"""Null temperature should display as 'N/A'."""
|
||||
_mock_graphql.return_value = {
|
||||
"disk": {
|
||||
"id": "d:1",
|
||||
"device": "sda",
|
||||
"name": "WD",
|
||||
"serialNum": "SN1",
|
||||
"size": 1073741824,
|
||||
"temperature": None,
|
||||
}
|
||||
}
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="disk_details", disk_id="d:1")
|
||||
assert result["summary"]["temperature"] == "N/A"
|
||||
|
||||
async def test_logs_null_log_file(self, _mock_graphql: AsyncMock) -> None:
|
||||
"""logFile being null should return an empty dict."""
|
||||
_mock_graphql.return_value = {"logFile": None}
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="logs", log_path="/var/log/syslog")
|
||||
assert result == {}
|
||||
|
||||
async def test_disk_details_not_found(self, _mock_graphql: AsyncMock) -> None:
|
||||
_mock_graphql.return_value = {"disk": None}
|
||||
tool_fn = _make_tool()
|
||||
|
||||
Reference in New Issue
Block a user