aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-19 08:27:49 +0300
committerGravatar ks129 <[email protected]>2020-05-19 08:27:49 +0300
commiteb9909f90706803694a37ae30336c3d6a4b475ab (patch)
tree8c3258917e96ed014ebdf3594f32b883d6e5b503
parentEH Tests: Added tests for `get_help_command`in `OtherErrorHandlerTests` (diff)
EH Tests: Added test for `try_get_tag` `get_command` calling
-rw-r--r--tests/bot/cogs/test_error_handler.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/bot/cogs/test_error_handler.py b/tests/bot/cogs/test_error_handler.py
index 615c0e455..b92a67fbe 100644
--- a/tests/bot/cogs/test_error_handler.py
+++ b/tests/bot/cogs/test_error_handler.py
@@ -6,6 +6,7 @@ from discord.ext.commands import errors
from bot.api import ResponseCodeError
from bot.cogs.error_handler import ErrorHandler
from bot.cogs.moderation.silence import Silence
+from bot.cogs.tags import Tags
from tests.helpers import MockBot, MockContext
@@ -231,6 +232,24 @@ class TrySilenceTests(unittest.IsolatedAsyncioTestCase):
self.assertFalse(await self.cog.try_silence(self.ctx))
+class TryGetTagTests(unittest.IsolatedAsyncioTestCase):
+ """Tests for `try_get_tag` function."""
+
+ def setUp(self):
+ self.bot = MockBot()
+ self.ctx = MockContext()
+ self.tag = Tags(self.bot)
+ self.cog = ErrorHandler(self.bot)
+ self.bot.get_command.return_value = self.tag.get_command
+
+ 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"
+ await self.cog.try_get_tag(self.ctx)
+ self.bot.get_command.assert_called_once_with("tags get")
+
+
class OtherErrorHandlerTests(unittest.IsolatedAsyncioTestCase):
"""Other `ErrorHandler` tests."""