Node-RED MCP medium: N1 typed errors, N3 FlowVisualization, N4 dynamic dimensions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user