aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2022-09-24 16:00:41 +0300
committerGravatar mbaruh <[email protected]>2022-09-24 16:00:41 +0300
commit8c2ed9b61d8b80a521122e7bbe095c3211725744 (patch)
tree20f8e958486e86b4d5fe789c7637e5784f6b5531 /tests/helpers.py
parentConvert all setting entries to pydnatic models (diff)
parentMerge pull request #2232 from python-discord/bot-2231-enhancements (diff)
Merge branch 'main' into new-filters
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index e74306d23..28a8e40a7 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -317,7 +317,7 @@ class MockBot(CustomMockMixin, unittest.mock.MagicMock):
guild_id=1,
intents=discord.Intents.all(),
)
- additional_spec_asyncs = ("wait_for", "redis_ready")
+ additional_spec_asyncs = ("wait_for",)
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
@@ -492,6 +492,28 @@ class MockAttachment(CustomMockMixin, unittest.mock.MagicMock):
spec_set = attachment_instance
+message_reference_instance = discord.MessageReference(
+ message_id=unittest.mock.MagicMock(id=1),
+ channel_id=unittest.mock.MagicMock(id=2),
+ guild_id=unittest.mock.MagicMock(id=3)
+)
+
+
+class MockMessageReference(CustomMockMixin, unittest.mock.MagicMock):
+ """
+ A MagicMock subclass to mock MessageReference objects.
+
+ Instances of this class will follow the specification of `discord.MessageReference` instances.
+ For more information, see the `MockGuild` docstring.
+ """
+ spec_set = message_reference_instance
+
+ def __init__(self, *, reference_author_is_bot: bool = False, **kwargs):
+ super().__init__(**kwargs)
+ referenced_msg_author = MockMember(name="bob", bot=reference_author_is_bot)
+ self.resolved = MockMessage(author=referenced_msg_author)
+
+
class MockMessage(CustomMockMixin, unittest.mock.MagicMock):
"""
A MagicMock subclass to mock Message objects.