Node-RED MCP medium: N1 typed errors, N3 FlowVisualization, N4 dynamic dimensions

This commit is contained in:
root
2026-07-04 20:54:52 +00:00
parent a1026df830
commit 8aea6fbb7f
8 changed files with 203 additions and 492 deletions

View File

@@ -6,6 +6,7 @@ import httpx
import pytest
from nodered_mcp.client import NodeRedClient, get_client, reset_client
from nodered_mcp.exceptions import ValidationError, NotFoundError, AuthError, UpstreamError
class TestNodeRedClient:
@@ -62,7 +63,7 @@ class TestNodeRedClient:
mock_response.text = "Bad Request"
with patch.object(client._http, "request", return_value=mock_response):
with pytest.raises(RuntimeError, match="Node-RED API error 400: Bad Request"):
with pytest.raises(ValidationError, match="Node-RED API error 400: Bad Request"):
await client._request("GET", "/flows")
@pytest.mark.asyncio
@@ -73,7 +74,7 @@ class TestNodeRedClient:
mock_response.text = "Not Found"
with patch.object(client._http, "request", return_value=mock_response):
with pytest.raises(RuntimeError, match="Node-RED API error 404: Not Found"):
with pytest.raises(NotFoundError, match="Node-RED API error 404: Not Found"):
await client._request("GET", "/flow/nonexistent")
@pytest.mark.asyncio
@@ -84,7 +85,7 @@ class TestNodeRedClient:
mock_response.text = "Internal Server Error"
with patch.object(client._http, "request", return_value=mock_response):
with pytest.raises(RuntimeError, match="Node-RED API error 500"):
with pytest.raises(UpstreamError, match="Node-RED API error 500"):
await client._request("POST", "/flows")
@pytest.mark.asyncio
@@ -367,7 +368,7 @@ class TestOAuthAuth:
mock_auth_client.__aexit__ = AsyncMock(return_value=None)
mock_auth_cls.return_value = mock_auth_client
with pytest.raises(RuntimeError, match="OAuth token error 401"):
with pytest.raises(AuthError, match="OAuth token error 401"):
await client._ensure_oauth_token()
@pytest.mark.asyncio