aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-08-18 15:02:13 -0700
committerGravatar MarkKoz <[email protected]>2020-08-18 15:56:34 -0700
commit2fd2c77035e87dde009c39aa7345e4871d5b41df (patch)
tree1d18064862e95d68be67f0b48be342c134cd073b /tests
parentSilence: rename caches (diff)
Silence: cancel init task when cog unloads
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/moderation/test_silence.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
index a66d27d08..d56a731b6 100644
--- a/tests/bot/cogs/moderation/test_silence.py
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -127,9 +127,12 @@ class SilenceCogTests(unittest.IsolatedAsyncioTestCase):
self.cog._reschedule.assert_awaited_once_with()
def test_cog_unload_cancelled_tasks(self):
- """All scheduled tasks were cancelled."""
+ """The init task was cancelled."""
+ self.cog._init_task = asyncio.Future()
self.cog.cog_unload()
- self.cog.scheduler.cancel_all.assert_called_once_with()
+
+ # It's too annoying to test cancel_all since it's a done callback and wrapped in a lambda.
+ self.assertTrue(self.cog._init_task.cancelled())
@autospec(silence, "with_role_check")
@mock.patch.object(silence, "MODERATION_ROLES", new=(1, 2, 3))