Merge pull request #1769 from sai-samarth/fix/whatsapp-send-message-support
Clean merge — PR is current against main, tests pass, implementation matches existing gateway WhatsApp bridge pattern.
This commit is contained in:
@@ -398,6 +398,25 @@ class TestSendToPlatformChunking:
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestSendToPlatformWhatsapp:
|
||||
def test_whatsapp_routes_via_local_bridge_sender(self):
|
||||
chat_id = "test-user@lid"
|
||||
async_mock = AsyncMock(return_value={"success": True, "platform": "whatsapp", "chat_id": chat_id, "message_id": "abc123"})
|
||||
|
||||
with patch("tools.send_message_tool._send_whatsapp", async_mock):
|
||||
result = asyncio.run(
|
||||
_send_to_platform(
|
||||
Platform.WHATSAPP,
|
||||
SimpleNamespace(enabled=True, token=None, extra={"bridge_port": 3000}),
|
||||
chat_id,
|
||||
"hello from hermes",
|
||||
)
|
||||
)
|
||||
|
||||
assert result["success"] is True
|
||||
async_mock.assert_awaited_once_with({"bridge_port": 3000}, chat_id, "hello from hermes")
|
||||
|
||||
|
||||
class TestSendTelegramHtmlDetection:
|
||||
"""Verify that messages containing HTML tags are sent with parse_mode=HTML
|
||||
and that plain / markdown messages use MarkdownV2."""
|
||||
|
||||
Reference in New Issue
Block a user