mirror of
https://github.com/jmagar/unraid-mcp.git
synced 2026-03-23 12:39:24 -07:00
BREAKING CHANGE: Replaces 15 separate MCP tools (unraid_info, unraid_array, unraid_storage, unraid_docker, unraid_vm, unraid_notifications, unraid_rclone, unraid_users, unraid_keys, unraid_health, unraid_settings, unraid_customization, unraid_plugins, unraid_oidc, unraid_live) with a single `unraid` tool using action (domain) + subaction (operation) routing. New interface: unraid(action="system", subaction="overview") replaces unraid_info(action="overview"). All 15 domains and ~108 subactions preserved. - Add unraid_mcp/tools/unraid.py (1891 lines, all domains consolidated) - Remove 15 individual tool files - Update tools/__init__.py to register single unified tool - Update server.py for new tool registration pattern - Update subscriptions/manager.py and resources.py for new tool names - Update all 25 test files + integration/contract/safety/schema/property tests - Update mcporter smoke-test script for new tool interface - Bump version 0.6.0 → 1.0.0 Co-authored-by: Claude <noreply@anthropic.com>
64 lines
1.9 KiB
Python
64 lines
1.9 KiB
Python
# tests/test_oidc.py
|
|
"""Tests for oidc subactions of the consolidated unraid tool."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
from conftest import make_tool_fn
|
|
|
|
|
|
@pytest.fixture
|
|
def _mock_graphql():
|
|
with patch("unraid_mcp.tools.unraid.make_graphql_request", new_callable=AsyncMock) as m:
|
|
yield m
|
|
|
|
|
|
def _make_tool():
|
|
return make_tool_fn("unraid_mcp.tools.unraid", "register_unraid_tool", "unraid")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_providers_returns_list(_mock_graphql):
|
|
_mock_graphql.return_value = {
|
|
"oidcProviders": [
|
|
{"id": "1:local", "name": "Google", "clientId": "abc", "scopes": ["openid"]}
|
|
]
|
|
}
|
|
result = await _make_tool()(action="oidc", subaction="providers")
|
|
assert "providers" in result
|
|
assert len(result["providers"]) == 1
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_public_providers(_mock_graphql):
|
|
_mock_graphql.return_value = {"publicOidcProviders": []}
|
|
result = await _make_tool()(action="oidc", subaction="public_providers")
|
|
assert "providers" in result
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_provider_requires_provider_id(_mock_graphql):
|
|
from unraid_mcp.core.exceptions import ToolError
|
|
|
|
with pytest.raises(ToolError, match="provider_id"):
|
|
await _make_tool()(action="oidc", subaction="provider")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_validate_session_requires_token(_mock_graphql):
|
|
from unraid_mcp.core.exceptions import ToolError
|
|
|
|
with pytest.raises(ToolError, match="token"):
|
|
await _make_tool()(action="oidc", subaction="validate_session")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_configuration(_mock_graphql):
|
|
_mock_graphql.return_value = {
|
|
"oidcConfiguration": {"providers": [], "defaultAllowedOrigins": []}
|
|
}
|
|
result = await _make_tool()(action="oidc", subaction="configuration")
|
|
assert "providers" in result
|