aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2023-06-22 18:21:12 +0200
committerGravatar GitHub <[email protected]>2023-06-22 18:21:12 +0200
commit65f38f9f47a3e4d8a95311577da4d4cf4af94ce6 (patch)
tree4e502bc659b7232d98c65a8942a0d67c089b9187 /tests
parentRemove casing in domain filtering (#2654) (diff)
parentUpdate NOMINATION_MESSAGE_REGEX for new discord.User.__str__ behaviour (diff)
Merge pull request #2642 from python-discord/dependabot/pip/pydis-core-9.8.0
Bump pydis-core from 9.7.0 to 9.8.0
Diffstat (limited to 'tests')
-rw-r--r--tests/helpers.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index b5a3f2463..26ac42697 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -256,6 +256,9 @@ class MockMember(CustomMockMixin, unittest.mock.Mock, ColourMixin, HashableMixin
if "mention" not in kwargs:
self.mention = f"@{self.name}"
+ def get_role(self, role_id: int) -> MockRole | None:
+ return discord.utils.get(self.roles, id=role_id)
+
# Create a User instance to get a realistic Mock of `discord.User`
_user_data_mock = collections.defaultdict(unittest.mock.MagicMock, {
@@ -522,7 +525,18 @@ class MockInteraction(CustomMockMixin, unittest.mock.MagicMock):
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())
+attachment_data = {
+ "id": 1,
+ "size": 14,
+ "filename": "jchrist.png",
+ "url": "https://google.com",
+ "proxy_url": "https://google.com",
+ "waveform": None,
+}
+attachment_instance = discord.Attachment(
+ data=attachment_data,
+ state=unittest.mock.MagicMock(),
+)
class MockAttachment(CustomMockMixin, unittest.mock.MagicMock):