Skip to content

Your lightweight open-source personal agent.

test(telegram): cover plain and fragment media URLs

Xubin Rendf6158ec1891
diff --git a/nanobot/channels/telegram/tests/test_telegram_channel.py b/nanobot/channels/telegram/tests/test_telegram_channel.py
index dd618464c..680690451 100644
--- a/nanobot/channels/telegram/tests/test_telegram_channel.py
+++ b/nanobot/channels/telegram/tests/test_telegram_channel.py
@@ -1907,7 +1907,12 @@ async def test_send_reply_infers_topic_from_message_id_cache() -> None:
@pytest.mark.asyncio
-async def test_send_remote_media_url_after_security_validation(monkeypatch) -> None:
[email protected]("media_url", [
+ "https://example.com/cat.jpg",
+ "https://example.com/cat.jpg?width=672",
+ "https://example.com/cat.jpg#preview",
+])
+async def test_send_remote_media_url_after_security_validation(monkeypatch, media_url) -> None:
channel = TelegramChannel(
TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),
MessageBus(),
@@ -1920,7 +1925,7 @@ async def test_send_remote_media_url_after_security_validation(monkeypatch) -> N
channel="telegram",
chat_id="123",
content="",
- media=["https://example.com/cat.jpg?width=672"],
+ media=[media_url],
)
)
@@ -1928,7 +1933,7 @@ async def test_send_remote_media_url_after_security_validation(monkeypatch) -> N
{
"kind": "photo",
"chat_id": 123,
- "photo": "https://example.com/cat.jpg?width=672",
+ "photo": media_url,
"reply_parameters": None,
}
]