Files
nodered-mcp/tests/tools/test_settings.py
Joe Carter 764d123fdb Initial commit: Node-RED MCP server (Python/FastMCP)
22-tool MCP server for Node-RED flow management with Pydantic models,
incremental flow patching, layout linting, and flexible auth (token,
basic, OAuth2). 137 tests, full ruff compliance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:19:33 +00:00

54 lines
1.8 KiB
Python

"""Tests for settings tools."""
import pytest
from nodered_mcp.client import NodeRedClient
@pytest.mark.asyncio
class TestGetSettings:
async def test_get_settings(self, mock_client: NodeRedClient) -> None:
from nodered_mcp.tools.settings import get_settings
result = await get_settings.fn()
# Should return Settings model
from nodered_mcp.models.responses import Settings
assert isinstance(result, Settings)
assert result.http_node_root != ""
assert result.version != ""
mock_client.get_settings.assert_called_once()
async def test_get_settings_with_user(self, mock_client: NodeRedClient) -> None:
from nodered_mcp.tools.settings import get_settings
result = await get_settings.fn()
# User field should be populated from sample data
assert result.user is not None
assert "username" in result.user
@pytest.mark.asyncio
class TestGetDiagnostics:
async def test_get_diagnostics(self, mock_client: NodeRedClient) -> None:
from nodered_mcp.tools.settings import get_diagnostics
result = await get_diagnostics.fn()
# Should return DiagnosticsResult wrapping data
from nodered_mcp.models.responses import DiagnosticsResult
assert isinstance(result, DiagnosticsResult)
assert isinstance(result.data, dict)
assert len(result.data) > 0
mock_client.get_diagnostics.assert_called_once()
async def test_get_diagnostics_preserves_structure(self, mock_client: NodeRedClient) -> None:
from nodered_mcp.tools.settings import get_diagnostics
result = await get_diagnostics.fn()
# Nested structure from sample_diagnostics_data should be preserved
assert "report" in result.data
assert "versions" in result.data["report"]