aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-07-05 19:48:29 -0400
committerGravatar ToxicKidz <[email protected]>2021-07-05 19:48:29 -0400
commit2a5a15f69d8ea3079f60e0e5d44387bc59061de5 (patch)
tree39fac2cbc9992c7692e8eecc37d731ab5eefeab9 /tests/helpers.py
parentchore: Add the codejam create command (diff)
chore: Update tests for the new codejam create command
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index e3dc5fe5b..eedd7a601 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -361,6 +361,27 @@ class MockDMChannel(CustomMockMixin, unittest.mock.Mock, HashableMixin):
super().__init__(**collections.ChainMap(kwargs, default_kwargs))
+# Create CategoryChannel instance to get a realistic MagicMock of `discord.CategoryChannel`
+category_channel_data = {
+ 'id': 1,
+ 'type': discord.ChannelType.category,
+ 'name': 'category',
+ 'position': 1,
+}
+
+state = unittest.mock.MagicMock()
+guild = unittest.mock.MagicMock()
+category_channel_instance = discord.CategoryChannel(
+ state=state, guild=guild, data=category_channel_data
+)
+
+
+class MockCategoryChannel(CustomMockMixin, unittest.mock.Mock, HashableMixin):
+ def __init__(self, **kwargs) -> None:
+ default_kwargs = {'id': next(self.discord_id)}
+ super().__init__(**collections.ChainMap(default_kwargs, kwargs))
+
+
# Create a Message instance to get a realistic MagicMock of `discord.Message`
message_data = {
'id': 1,
@@ -403,6 +424,7 @@ class MockContext(CustomMockMixin, unittest.mock.MagicMock):
self.guild = kwargs.get('guild', MockGuild())
self.author = kwargs.get('author', MockMember())
self.channel = kwargs.get('channel', MockTextChannel())
+ self.message = kwargs.get('message', MockMessage())
self.invoked_from_error_handler = kwargs.get('invoked_from_error_handler', False)