From 1952720ef96608baf40827e0eb772590d7c75fe7 Mon Sep 17 00:00:00 2001 From: Jacob Magar Date: Sat, 14 Mar 2026 03:41:24 -0400 Subject: [PATCH] test(elicitation): fix test_setup.py style and add ToolError contract test --- tests/test_setup.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_setup.py b/tests/test_setup.py index 404fa4c..8ca5f50 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -1,11 +1,19 @@ -def test_credentials_not_configured_error_exists(): - from unraid_mcp.core.exceptions import CredentialsNotConfiguredError +import pytest +from unraid_mcp.core.exceptions import CredentialsNotConfiguredError, ToolError + + +def test_credentials_not_configured_error_exists(): err = CredentialsNotConfiguredError() assert str(err) == "Unraid credentials are not configured." def test_credentials_not_configured_error_is_exception(): - from unraid_mcp.core.exceptions import CredentialsNotConfiguredError + """CredentialsNotConfiguredError must be catchable as a plain Exception.""" + with pytest.raises(Exception): + raise CredentialsNotConfiguredError() - assert issubclass(CredentialsNotConfiguredError, Exception) + +def test_credentials_not_configured_error_is_not_tool_error(): + """CredentialsNotConfiguredError must NOT be a ToolError — it bypasses MCP protocol error handling.""" + assert not issubclass(CredentialsNotConfiguredError, ToolError)