diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/bot/cogs/test_jams.py | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/tests/bot/cogs/test_jams.py b/tests/bot/cogs/test_jams.py index 33dee593e..3e71370c2 100644 --- a/tests/bot/cogs/test_jams.py +++ b/tests/bot/cogs/test_jams.py @@ -1,5 +1,7 @@  import unittest +from unittest.mock import patch +from bot.cogs.jams import CodeJams  from bot.constants import Roles  from tests.helpers import MockBot, MockContext, MockMember, MockRole @@ -11,4 +13,18 @@ class JamCreateTeamTests(unittest.IsolatedAsyncioTestCase):          self.bot = MockBot()          self.admin_role = MockRole(name="Admins", id=Roles.admins)          self.command_user = MockMember([self.admin_role]) -        self.context = MockContext(bot=self.bot, author=self.command_user) +        self.ctx = MockContext(bot=self.bot, author=self.command_user) +        self.cog = CodeJams(self.bot) + +    @patch("bot.cogs.jams.utils") +    async def test_too_small_amount_of_team_members_passed(self, utils_mock): +        """Should `ctx.send` and exit early when too small amount of members.""" +        for case in (1, 2): +            with self.subTest(amount_of_members=case): +                self.ctx.reset_mock() +                utils_mock.reset_mock() +                await self.cog.createteam( +                    self.cog, self.ctx, team_name="foo", members=(MockMember() for _ in range(case)) +                ) +                self.ctx.send.assert_awaited_once() +                utils_mock.get.assert_not_called() | 
