diff options
author | 2020-05-18 11:15:05 +0300 | |
---|---|---|
committer | 2020-05-18 11:15:05 +0300 | |
commit | be9cb47eddb2c4920a7e0956a79ca555a7243bf7 (patch) | |
tree | 35829b3eef0fb71633197433c5874a88152b5322 | |
parent | Merge pull request #858 from python-discord/decorator-factory-mutability-tag (diff) |
EH Tests: Created test cases set + already handled error test
Created test that make sure when error is already handled in local error
handler, this don't await `ctx.send` to make sure that this don't move
forward.
-rw-r--r-- | tests/bot/cogs/test_error_handler.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/bot/cogs/test_error_handler.py b/tests/bot/cogs/test_error_handler.py new file mode 100644 index 000000000..6aca03030 --- /dev/null +++ b/tests/bot/cogs/test_error_handler.py @@ -0,0 +1,22 @@ +import unittest + +from discord.ext.commands import errors + +from bot.cogs.error_handler import ErrorHandler +from tests.helpers import MockBot, MockContext + + +class ErrorHandlerTests(unittest.IsolatedAsyncioTestCase): + """Tests for error handler functionality.""" + + def setUp(self): + self.bot = MockBot() + self.ctx = MockContext(bot=self.bot) + self.cog = ErrorHandler(self.bot) + + async def test_error_handler_already_handled(self): + """Should not do anything when error is already handled by local error handler.""" + error = errors.CommandError() + error.handled = "foo" + await self.cog.on_command_error(self.ctx, error) + self.ctx.send.assert_not_awaited() |