aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-09-08 10:32:22 -0700
committerGravatar MarkKoz <[email protected]>2020-09-08 10:32:22 -0700
commit39b6e25ef5b50bfcd16ec1843b4abb72bf125a35 (patch)
treed7cad95aa720b6a57dc1f96ee1ca02c2e1a2fc35 /tests
parentFix tests for has_any_role_check (diff)
Fix cog_check tests
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/moderation/test_silence.py10
-rw-r--r--tests/bot/cogs/test_slowmode.py10
2 files changed, 12 insertions, 8 deletions
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
index ab3d0742a..5a664b1f8 100644
--- a/tests/bot/cogs/moderation/test_silence.py
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -253,9 +253,11 @@ class SilenceTests(unittest.IsolatedAsyncioTestCase):
self.cog.cog_unload()
asyncio_mock.create_task.assert_not_called()
- @mock.patch("bot.cogs.moderation.silence.with_role_check")
+ @mock.patch("discord.ext.commands.has_any_role")
@mock.patch("bot.cogs.moderation.silence.MODERATION_ROLES", new=(1, 2, 3))
- def test_cog_check(self, role_check):
+ async def test_cog_check(self, role_check):
"""Role check is called with `MODERATION_ROLES`"""
- self.cog.cog_check(self.ctx)
- role_check.assert_called_once_with(self.ctx, *(1, 2, 3))
+ role_check.return_value.predicate = mock.AsyncMock()
+ await self.cog.cog_check(self.ctx)
+ role_check.assert_called_once_with(*(1, 2, 3))
+ role_check.return_value.predicate.assert_awaited_once_with(self.ctx)
diff --git a/tests/bot/cogs/test_slowmode.py b/tests/bot/cogs/test_slowmode.py
index f442814c8..5e6d6a26a 100644
--- a/tests/bot/cogs/test_slowmode.py
+++ b/tests/bot/cogs/test_slowmode.py
@@ -103,9 +103,11 @@ class SlowmodeTests(unittest.IsolatedAsyncioTestCase):
f'{Emojis.check_mark} The slowmode delay for #meta has been reset to 0 seconds.'
)
- @mock.patch("bot.cogs.moderation.slowmode.with_role_check")
+ @mock.patch("bot.cogs.moderation.slowmode.has_any_role")
@mock.patch("bot.cogs.moderation.slowmode.MODERATION_ROLES", new=(1, 2, 3))
- def test_cog_check(self, role_check):
+ async def test_cog_check(self, role_check):
"""Role check is called with `MODERATION_ROLES`"""
- self.cog.cog_check(self.ctx)
- role_check.assert_called_once_with(self.ctx, *(1, 2, 3))
+ role_check.return_value.predicate = mock.AsyncMock()
+ await self.cog.cog_check(self.ctx)
+ role_check.assert_called_once_with(*(1, 2, 3))
+ role_check.return_value.predicate.assert_awaited_once_with(self.ctx)