mirror of
https://github.com/jmagar/unraid-mcp
synced 2026-04-21 13:37:53 +00:00
test(unraid-mcp-a07): add missing tests for sso_enabled, system/array error path, vm/reboot happy path
This commit is contained in:
parent
54c66ed9a2
commit
d20a095901
3 changed files with 36 additions and 0 deletions
|
|
@ -58,3 +58,17 @@ async def test_set_theme_success(_mock_graphql):
|
|||
}
|
||||
result = await _make_tool()(action="customization", subaction="set_theme", theme_name="azure")
|
||||
assert result["success"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sso_enabled_returns_true(_mock_graphql):
|
||||
_mock_graphql.return_value = {"isSSOEnabled": True}
|
||||
result = await _make_tool()(action="customization", subaction="sso_enabled")
|
||||
assert result["isSSOEnabled"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sso_enabled_returns_false(_mock_graphql):
|
||||
_mock_graphql.return_value = {"isSSOEnabled": False}
|
||||
result = await _make_tool()(action="customization", subaction="sso_enabled")
|
||||
assert result["isSSOEnabled"] is False
|
||||
|
|
|
|||
|
|
@ -194,6 +194,20 @@ class TestUnraidInfoTool:
|
|||
assert len(result["ups_devices"]) == 1
|
||||
assert result["ups_devices"][0]["model"] == "APC"
|
||||
|
||||
async def test_array_empty_response_raises_tool_error(self, _mock_graphql: AsyncMock) -> None:
|
||||
"""Empty/null array response should raise ToolError."""
|
||||
_mock_graphql.return_value = {"array": None}
|
||||
tool_fn = _make_tool()
|
||||
with pytest.raises(ToolError, match="No array information returned"):
|
||||
await tool_fn(action="system", subaction="array")
|
||||
|
||||
async def test_array_missing_key_raises_tool_error(self, _mock_graphql: AsyncMock) -> None:
|
||||
"""Response with no 'array' key at all should raise ToolError."""
|
||||
_mock_graphql.return_value = {}
|
||||
tool_fn = _make_tool()
|
||||
with pytest.raises(ToolError, match="No array information returned"):
|
||||
await tool_fn(action="system", subaction="array")
|
||||
|
||||
|
||||
class TestInfoNetworkErrors:
|
||||
"""Tests for network-level failures in info operations."""
|
||||
|
|
|
|||
|
|
@ -130,6 +130,14 @@ class TestVmActions:
|
|||
assert result["success"] is True
|
||||
assert result["subaction"] == "resume"
|
||||
|
||||
async def test_reboot_vm(self, _mock_graphql: AsyncMock) -> None:
|
||||
_mock_graphql.return_value = {"vm": {"reboot": True}}
|
||||
tool_fn = _make_tool()
|
||||
result = await tool_fn(action="vm", subaction="reboot", vm_id="uuid-1")
|
||||
assert result["success"] is True
|
||||
assert result["subaction"] == "reboot"
|
||||
assert result["vm_id"] == "uuid-1"
|
||||
|
||||
async def test_mutation_unexpected_response(self, _mock_graphql: AsyncMock) -> None:
|
||||
_mock_graphql.return_value = {"vm": {}}
|
||||
tool_fn = _make_tool()
|
||||
|
|
|
|||
Loading…
Reference in a new issue