From 98fea1323b33eb18844342284d5ea4be4ceb3c2d Mon Sep 17 00:00:00 2001 From: Zavian <36817799+Zavianx@users.noreply.github.com> Date: Tue, 28 Jul 2026 09:24:45 -0700 Subject: [PATCH] test(gateway): keep Discord document-handling tests hermetic against host DNS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests mock the actual download; stub is_safe_url so host DNS/proxy mappings for cdn.discordapp.com can't decide whether document handling is exercised. Residual hunk salvaged from PR #25426 — the rest of that PR's hermeticity fixes (bedrock botocore fakes, faster_whisper module fakes, kittentts plain-sequence PCM, web-provider SSRF stubs) have since landed on main in equivalent form. --- tests/gateway/test_discord_document_handling.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/gateway/test_discord_document_handling.py b/tests/gateway/test_discord_document_handling.py index c9f8f53c2835..39b69dedca20 100644 --- a/tests/gateway/test_discord_document_handling.py +++ b/tests/gateway/test_discord_document_handling.py @@ -97,6 +97,9 @@ def _redirect_cache(tmp_path, monkeypatch): def adapter(monkeypatch): monkeypatch.setattr(discord_platform.discord, "DMChannel", FakeDMChannel, raising=False) monkeypatch.setattr(discord_platform.discord, "Thread", FakeThread, raising=False) + # These tests mock the actual download. Do not let host DNS/proxy mappings + # for cdn.discordapp.com decide whether document handling is exercised. + monkeypatch.setattr(discord_platform, "is_safe_url", lambda _url: True) config = PlatformConfig(enabled=True, token="fake-token") a = DiscordAdapter(config)