aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bot
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2023-02-27 19:29:00 +0000
committerGravatar GitHub <[email protected]>2023-02-27 19:29:00 +0000
commit909fb61cbd894c6f555f054ff46710afe7d301b0 (patch)
treee221d8d62cb8e98d8de029ffd8eff6b4eccb4c1f /tests/bot
parentMerge pull request #2417 from python-discord/swfarnsworth-code-command-paste (diff)
parentMerge branch 'main' into migration/tag (diff)
Merge pull request #2403 from Ibrahim2750mi/migration/tag
Migrated `!tags` command to slash command `/tag`
Diffstat (limited to 'tests/bot')
-rw-r--r--tests/bot/exts/backend/test_error_handler.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/bot/exts/backend/test_error_handler.py b/tests/bot/exts/backend/test_error_handler.py
index 092de0556..0ba2fcf11 100644
--- a/tests/bot/exts/backend/test_error_handler.py
+++ b/tests/bot/exts/backend/test_error_handler.py
@@ -334,13 +334,13 @@ class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
self.ctx = MockContext()
self.tag = Tags(self.bot)
self.cog = error_handler.ErrorHandler(self.bot)
- self.bot.get_command.return_value = self.tag.get_command
+ self.bot.get_cog.return_value = self.tag
async def test_try_get_tag_get_command(self):
"""Should call `Bot.get_command` with `tags get` argument."""
- self.bot.get_command.reset_mock()
+ self.bot.get_cog.reset_mock()
await self.cog.try_get_tag(self.ctx)
- self.bot.get_command.assert_called_once_with("tags get")
+ self.bot.get_cog.assert_called_once_with("Tags")
async def test_try_get_tag_invoked_from_error_handler(self):
"""`self.ctx` should have `invoked_from_error_handler` `True`."""
@@ -350,14 +350,14 @@ class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
async def test_try_get_tag_no_permissions(self):
"""Test how to handle checks failing."""
- self.tag.get_command.can_run = AsyncMock(return_value=False)
+ self.bot.can_run = AsyncMock(return_value=False)
self.ctx.invoked_with = "foo"
self.assertIsNone(await self.cog.try_get_tag(self.ctx))
async def test_try_get_tag_command_error(self):
"""Should call `on_command_error` when `CommandError` raised."""
err = errors.CommandError()
- self.tag.get_command.can_run = AsyncMock(side_effect=err)
+ self.bot.can_run = AsyncMock(side_effect=err)
self.cog.on_command_error = AsyncMock()
self.assertIsNone(await self.cog.try_get_tag(self.ctx))
self.cog.on_command_error.assert_awaited_once_with(self.ctx, err)
@@ -365,7 +365,7 @@ class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
async def test_dont_call_suggestion_tag_sent(self):
"""Should never call command suggestion if tag is already sent."""
self.ctx.message = MagicMock(content="foo")
- self.ctx.invoke = AsyncMock(return_value=True)
+ self.tag.get_command_ctx = AsyncMock(return_value=True)
self.cog.send_command_suggestion = AsyncMock()
await self.cog.try_get_tag(self.ctx)
@@ -385,7 +385,7 @@ class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
async def test_call_suggestion(self):
"""Should call command suggestion if user is not a mod."""
self.ctx.invoked_with = "foo"
- self.ctx.invoke = AsyncMock(return_value=False)
+ self.tag.get_command_ctx = AsyncMock(return_value=False)
self.cog.send_command_suggestion = AsyncMock()
await self.cog.try_get_tag(self.ctx)