test(gateway): keep Discord document-handling tests hermetic against host DNS

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.
This commit is contained in:
Zavian 2026-07-28 09:24:45 -07:00 committed by Teknium
parent 63be8ce863
commit 98fea1323b

View file

@ -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)