aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-18 20:05:19 +0300
committerGravatar ks129 <[email protected]>2020-05-18 20:05:19 +0300
commit2c488838dec67daa40e11249c9e578c1450ce594 (patch)
treefbe55dd4615817af207628b359495b6ae1aa3f47
parentEH Tests: Created `try_silence` test to test silence command calling (diff)
EH Tests: Created `try_silence` test to test unsilence command calling
-rw-r--r--tests/bot/cogs/test_error_handler.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/bot/cogs/test_error_handler.py b/tests/bot/cogs/test_error_handler.py
index 30326d445..610d3ace5 100644
--- a/tests/bot/cogs/test_error_handler.py
+++ b/tests/bot/cogs/test_error_handler.py
@@ -218,3 +218,20 @@ class TrySilenceTests(unittest.IsolatedAsyncioTestCase):
self.bot.get_command.return_value,
duration=min(case.count("h")*2, 15)
)
+
+ async def test_try_silence_unsilence(self):
+ """Should call unsilence command."""
+ bot = MockBot()
+ silence = Silence(bot)
+ silence.silence.can_run = AsyncMock(return_value=True)
+ cog = ErrorHandler(bot)
+ ctx = MockContext(bot=bot)
+ test_cases = ("unshh", "unshhhhh", "unshhhhhhhhh")
+
+ for case in test_cases:
+ with self.subTest(message=case):
+ bot.get_command.side_effect = (silence.silence, silence.unsilence)
+ ctx.reset_mock()
+ ctx.invoked_with = case
+ self.assertTrue(await cog.try_silence(ctx))
+ ctx.invoke.assert_awaited_once_with(silence.unsilence)