aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-07-22 16:21:38 -0700
committerGravatar MarkKoz <[email protected]>2020-07-22 16:39:26 -0700
commit92d3f88eb5c2348f3e4cb53a22a833bed61c6fb7 (patch)
tree5732460c41e96b89fcb7b24b1c9dbc8def3650e8 /tests
parentJam tests: fix category test (diff)
Jam tests: add subtests to non-existent category test
The test has to account for not only the name not matching, but also a lack of available spaces for new channels.
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/test_jams.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/bot/cogs/test_jams.py b/tests/bot/cogs/test_jams.py
index 54a096703..e6b2ac588 100644
--- a/tests/bot/cogs/test_jams.py
+++ b/tests/bot/cogs/test_jams.py
@@ -67,15 +67,26 @@ class JamCreateTeamTests(unittest.IsolatedAsyncioTestCase):
self.cog.add_roles.assert_awaited_once()
self.ctx.send.assert_awaited_once()
- async def test_category_dont_exist(self):
- """Should create code jam category."""
- await self.cog.get_category(self.guild)
+ async def test_category_doesnt_exist(self):
+ """Should create a new code jam category."""
+ subtests = (
+ [],
+ [get_mock_category(jams.MAX_CHANNELS - 1, jams.CATEGORY_NAME)],
+ [get_mock_category(48, "other")],
+ )
+
+ for categories in subtests:
+ self.guild.reset_mock()
+ self.guild.categories = categories
+
+ with self.subTest(categories=categories):
+ await self.cog.get_category(self.guild)
- self.guild.create_category_channel.assert_awaited_once()
- category_overwrites = self.guild.create_category_channel.call_args[1]["overwrites"]
+ self.guild.create_category_channel.assert_awaited_once()
+ category_overwrites = self.guild.create_category_channel.call_args[1]["overwrites"]
- self.assertFalse(category_overwrites[self.guild.default_role].read_messages)
- self.assertTrue(category_overwrites[self.guild.me].read_messages)
+ self.assertFalse(category_overwrites[self.guild.default_role].read_messages)
+ self.assertTrue(category_overwrites[self.guild.me].read_messages)
async def test_category_channel_exist(self):
"""Should not try to create category channel."""