Skip to content

Commit 624e7bf

Browse files
committed
fix: parse CallToolResult in test_config_entry_flow
Add parse_mcp_result to properly handle CallToolResult objects in test_get_config_entry_nonexistent and test_create_config_entry_helper_exists. Fixes CI test failures.
1 parent b3cc759 commit 624e7bf

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/src/e2e/workflows/config/test_config_entry_flow.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import pytest
88

9-
from tests.src.e2e.utilities.assertions import assert_mcp_success
9+
from tests.src.e2e.utilities.assertions import assert_mcp_success, parse_mcp_result
1010

1111
logger = logging.getLogger(__name__)
1212

@@ -41,7 +41,8 @@ async def test_get_config_entry_nonexistent(self, mcp_client):
4141
"ha_get_config_entry", {"entry_id": "nonexistent_entry_id"}
4242
)
4343
# Should fail with 404 or similar error
44-
assert not result.get("success", False)
44+
data = parse_mcp_result(result)
45+
assert not data.get("success", False)
4546

4647
# Note: Actual ha_create_config_entry_helper tests are intentionally limited
4748
# because they require specific configuration for each helper type.
@@ -61,10 +62,11 @@ async def test_create_config_entry_helper_exists(self, mcp_client):
6162

6263
# We expect this to fail (invalid config), but it proves tool exists
6364
# and validates the structure
64-
assert "success" in result, "Tool should return a result with success field"
65+
data = parse_mcp_result(result)
66+
assert "success" in data, "Tool should return a result with success field"
6567

6668
# If it succeeded unexpectedly, that's also fine - means empty config worked
6769
# If it failed, that's expected - we're just testing tool existence
6870
logger.info(
69-
f"Tool response (expected to fail with invalid config): {result.get('success')}"
71+
f"Tool response (expected to fail with invalid config): {data.get('success')}"
7072
)

0 commit comments

Comments
 (0)