diff options
| author | 2022-10-18 19:38:00 +0300 | |
|---|---|---|
| committer | 2022-10-18 19:38:00 +0300 | |
| commit | 5e6722816dfbbc961379badbb564286fa9547ca5 (patch) | |
| tree | 457dc4de4e0ad6dc227012bb20f05349d37bfc5e /tests | |
| parent | use tldextract for a correct url decomposition (diff) | |
| parent | Merge pull request #2293 from python-discord/fix-sequency-proxy-breaking-change (diff) | |
Merge branch 'main' into 1379-tranform-urls-upon-rich-embed-filter-application
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bot/exts/backend/test_error_handler.py | 13 | 
1 files changed, 11 insertions, 2 deletions
| diff --git a/tests/bot/exts/backend/test_error_handler.py b/tests/bot/exts/backend/test_error_handler.py index 7562f6aa8..eae1bae20 100644 --- a/tests/bot/exts/backend/test_error_handler.py +++ b/tests/bot/exts/backend/test_error_handler.py @@ -9,7 +9,7 @@ from bot.exts.backend import error_handler  from bot.exts.info.tags import Tags  from bot.exts.moderation.silence import Silence  from bot.utils.checks import InWhitelistCheckFailure -from tests.helpers import MockBot, MockContext, MockGuild, MockRole, MockTextChannel +from tests.helpers import MockBot, MockContext, MockGuild, MockRole, MockTextChannel, MockVoiceChannel  class ErrorHandlerTests(unittest.IsolatedAsyncioTestCase): @@ -192,7 +192,16 @@ class TrySilenceTests(unittest.IsolatedAsyncioTestCase):          self.bot = MockBot()          self.silence = Silence(self.bot)          self.bot.get_command.return_value = self.silence.silence -        self.ctx = MockContext(bot=self.bot) + +        # Use explicit mock channels so that discord.utils.get doesn't think +        # guild.text_channels is an async iterable due to the MagicMock having +        # a __aiter__ attr. +        guild_overrides = { +            "text_channels": [MockTextChannel(), MockTextChannel()], +            "voice_channels": [MockVoiceChannel(), MockVoiceChannel()], +        } +        self.guild = MockGuild(**guild_overrides) +        self.ctx = MockContext(bot=self.bot, guild=self.guild)          self.cog = error_handler.ErrorHandler(self.bot)      async def test_try_silence_context_invoked_from_error_handler(self): | 
