aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/backend/test_error_handler.py13
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):