From 4da0d06db2cfa56a629f1644d2a257e97e8d2a53 Mon Sep 17 00:00:00 2001 From: Kong Date: Sun, 24 May 2026 17:05:19 +0800 Subject: [PATCH] test(gateway): use allowed media root in queued follow-up test MEDIA:/tmp paths are filtered by delivery safe roots; mirror other tests by placing the fixture under an allowed cache directory. --- tests/gateway/test_tts_media_routing.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/gateway/test_tts_media_routing.py b/tests/gateway/test_tts_media_routing.py index f17d49870c..c896338a51 100644 --- a/tests/gateway/test_tts_media_routing.py +++ b/tests/gateway/test_tts_media_routing.py @@ -199,8 +199,11 @@ class _DiscordMediaFailureAdapter(BasePlatformAdapter): @pytest.mark.asyncio -async def test_queued_followup_delivery_strips_media_tag_from_text_and_sends_image(): +async def test_queued_followup_delivery_strips_media_tag_from_text_and_sends_image( + tmp_path, monkeypatch, +): event = _event(thread_id="topic-1") + media_file = _allowed_media_path(tmp_path, monkeypatch, "pricelist.png") runner = object.__new__(GatewayRunner) runner._thread_metadata_for_source = lambda source, anchor=None: {"thread_id": "topic-1"} runner._reply_anchor_for_event = lambda event: event.message_id @@ -219,7 +222,7 @@ async def test_queued_followup_delivery_strips_media_tag_from_text_and_sends_ima await GatewayRunner._deliver_queued_first_response( runner, - "Quote here\nMEDIA:/tmp/pricelist.png", + f"Quote here\nMEDIA:{media_file}", source=event.source, adapter=adapter, metadata={"thread_id": "topic-1"}, @@ -233,7 +236,7 @@ async def test_queued_followup_delivery_strips_media_tag_from_text_and_sends_ima ) adapter.send_multiple_images.assert_awaited_once_with( chat_id="chat-1", - images=[("file:///tmp/pricelist.png", "")], + images=[(f"file://{media_file.as_posix()}", "")], metadata={"thread_id": "topic-1"}, )