aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-19 08:35:15 +0300
committerGravatar ks129 <[email protected]>2020-05-19 08:35:15 +0300
commit0ffded4eaa2427a04f43aa3bb6088c3ac1e91f0e (patch)
treee56af8e587ac889c466feb504a1c55a84d62408c /tests
parentEH Tests: Added test for `try_get_tag` `invoked_from_error_handler` (diff)
EH Tests: Added test for `try_get_tag` checks fail
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/test_error_handler.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/bot/cogs/test_error_handler.py b/tests/bot/cogs/test_error_handler.py
index 35c223fcc..ba05076dd 100644
--- a/tests/bot/cogs/test_error_handler.py
+++ b/tests/bot/cogs/test_error_handler.py
@@ -245,17 +245,23 @@ class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
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.ctx.invoked_with = "my_some_not_existing_tag"
+ self.ctx.invoked_with = "foo"
await self.cog.try_get_tag(self.ctx)
self.bot.get_command.assert_called_once_with("tags get")
async def test_try_get_tag_invoked_from_error_handler(self):
"""`self.ctx` should have `invoked_from_error_handler` `True`."""
self.ctx.invoked_from_error_handler = False
- self.ctx.invoked_with = "my_some_not_existing_tag"
+ self.ctx.invoked_with = "foo"
await self.cog.try_get_tag(self.ctx)
self.assertTrue(self.ctx.invoked_from_error_handler)
+ async def test_try_get_tag_no_permissions(self):
+ """Should return `False` because checks fail."""
+ self.tag.get_command.can_run = AsyncMock(return_value=False)
+ self.ctx.invoked_with = "foo"
+ self.assertFalse(await self.cog.try_get_tag(self.ctx))
+
class OtherErrorHandlerTests(unittest.IsolatedAsyncioTestCase):
"""Other `ErrorHandler` tests."""