From d3b99876d6bbfb7b69cd54c690d934cb67c712ea Mon Sep 17 00:00:00 2001 From: MervinPraison Date: Fri, 14 Aug 2026 03:49:11 +0100 Subject: [PATCH] test(gateway): cover misspelled gateway block at load time (#3050) Adds load_gateway_config integration coverage for the #3050 validation path and documents load-time gateway block checks in the example. Supersedes #3060; core fix landed in #3079. Co-authored-by: botbikamordehai2-sketch --- examples/python/gateway_example.py | 3 ++- .../integration/test_websocket_integration.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/python/gateway_example.py b/examples/python/gateway_example.py index ca45b092d..4966dc8b4 100644 --- a/examples/python/gateway_example.py +++ b/examples/python/gateway_example.py @@ -7,7 +7,8 @@ multiple agents and managing real-time communication. from praisonaiagents import Agent, GatewayConfig, SessionConfig -# Configure the gateway +# Configure the gateway using the typed SDK GatewayConfig. +# In gateway.yaml, the optional ``gateway:`` block is validated at load time (#3050). gateway_config = GatewayConfig( host="127.0.0.1", port=8765, diff --git a/src/praisonai/tests/integration/test_websocket_integration.py b/src/praisonai/tests/integration/test_websocket_integration.py index 2b175fb8d..2fc7b1249 100644 --- a/src/praisonai/tests/integration/test_websocket_integration.py +++ b/src/praisonai/tests/integration/test_websocket_integration.py @@ -134,6 +134,24 @@ class TestWebSocketIntegration: assert "channels" in cfg assert cfg["channels"]["telegram"]["token"] == "test123" + @pytest.mark.asyncio + async def test_gateway_config_rejects_misspelled_server_block(self, tmp_path): + """Misspelled ``gateway:`` server settings fail at load time (#3050).""" + try: + from praisonai.gateway.server import WebSocketGateway + except ImportError: + pytest.skip("praisonai.gateway not available") + + bad_config = tmp_path / "bad.yaml" + bad_config.write_text( + "agents:\n bot:\n instructions: hi\n" + "channels:\n telegram:\n token: test123\n" + "gateway:\n drain_timout: 30\n" + ) + + with pytest.raises(ValueError, match="drain_timout"): + WebSocketGateway.load_gateway_config(str(bad_config)) + @pytest.mark.asyncio async def test_websocket_connect_and_message(self): """Test actual WebSocket connection to gateway server.