test(telegram): cover plain and fragment media URLs
This commit is contained in:
1 parent
9214390f9d
commit
df6158ec18
1 file changed
+8
-3
@@ -1907,7 +1907,12 @@ async def test_send_reply_infers_topic_from_message_id_cache() -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_send_remote_media_url_after_security_validation(monkeypatch) -> None:
|
@pytest.mark.parametrize("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(
|
channel = TelegramChannel(
|
||||||
TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),
|
TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),
|
||||||
MessageBus(),
|
MessageBus(),
|
||||||
@@ -1920,7 +1925,7 @@ async def test_send_remote_media_url_after_security_validation(monkeypatch) -> N
|
|||||||
channel="telegram",
|
channel="telegram",
|
||||||
chat_id="123",
|
chat_id="123",
|
||||||
content="",
|
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",
|
"kind": "photo",
|
||||||
"chat_id": 123,
|
"chat_id": 123,
|
||||||
"photo": "https://example.com/cat.jpg?width=672",
|
"photo": media_url,
|
||||||
"reply_parameters": None,
|
"reply_parameters": None,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user