aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 4b980ac21..2d20b4d07 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -479,6 +479,26 @@ class MockContext(CustomMockMixin, unittest.mock.MagicMock):
self.invoked_from_error_handler = kwargs.get('invoked_from_error_handler', False)
+class MockInteraction(CustomMockMixin, unittest.mock.MagicMock):
+ """
+ A MagicMock subclass to mock Interaction objects.
+
+ Instances of this class will follow the specifications of `discord.Interaction`
+ instances. For more information, see the `MockGuild` docstring.
+ """
+ # spec_set = context_instance
+
+ def __init__(self, **kwargs) -> None:
+ super().__init__(**kwargs)
+ self.me = kwargs.get('me', MockMember())
+ self.client = kwargs.get('client', MockBot())
+ self.guild = kwargs.get('guild', MockGuild())
+ self.user = kwargs.get('user', 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)
+
+
attachment_instance = discord.Attachment(data=unittest.mock.MagicMock(id=1), state=unittest.mock.MagicMock())