aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-11-09 01:38:52 +0100
committerGravatar Numerlor <[email protected]>2021-11-09 01:38:52 +0100
commit74523cd6505699c79316ce15f725331b6f0a5e71 (patch)
treea8079a9a560469964c3d7e79fbd0978f0f5b2cb5 /tests/helpers.py
parentRemove try_get_tag ctx args test (diff)
parentMerge pull request #1872 from python-discord/experiments/isort (diff)
Merge remote-tracking branch 'upstream/main' into tag-groups
# Conflicts: # bot/converters.py # bot/exts/info/tags.py # tests/bot/test_converters.py
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 3978076ed..83b9b2363 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -235,6 +235,7 @@ class MockMember(CustomMockMixin, unittest.mock.Mock, ColourMixin, HashableMixin
self.roles = [MockRole(name="@everyone", position=1, id=0)]
if roles:
self.roles.extend(roles)
+ self.top_role = max(self.roles)
if 'mention' not in kwargs:
self.mention = f"@{self.name}"
@@ -278,7 +279,10 @@ def _get_mock_loop() -> unittest.mock.Mock:
# Since calling `create_task` on our MockBot does not actually schedule the coroutine object
# as a task in the asyncio loop, this `side_effect` calls `close()` on the coroutine object
# to prevent "has not been awaited"-warnings.
- loop.create_task.side_effect = lambda coroutine: coroutine.close()
+ def mock_create_task(coroutine, **kwargs):
+ coroutine.close()
+ return unittest.mock.Mock()
+ loop.create_task.side_effect = mock_create_task
return loop
@@ -439,6 +443,7 @@ class MockContext(CustomMockMixin, unittest.mock.MagicMock):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
+ self.me = kwargs.get('me', MockMember())
self.bot = kwargs.get('bot', MockBot())
self.guild = kwargs.get('guild', MockGuild())
self.author = kwargs.get('author', MockMember())