aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-10-11 19:54:47 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-10-11 19:54:47 +0200
commit6d9cb1ad99d064d8810feb553c6b0463c74c92d4 (patch)
tree065acf7342c0c474cce894ee36ae26cc7d582134 /tests/helpers.py
parentAdd tests for tests.base (diff)
Change pipeline testrunner to xmlrunner
I have change the testrunner from `unittest` to `xmlrunner` in the Azure pipeline to be able to publish our test results on Azure. This is the same runner as `site` uses to generate XML reports. In addition, I've cleaned up some small mistakes in docstrings and `README.md`.
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 64fc04afe..18c9866bf 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -50,7 +50,7 @@ class HashableMixin(discord.mixins.EqualityComparable):
class ColourMixin:
- """A mixin of Mocks that provides the aliasing of color->colour like discord.py does."""
+ """A mixin for Mocks that provides the aliasing of color->colour like discord.py does."""
@property
def color(self) -> discord.Colour:
@@ -159,14 +159,9 @@ class MockRole(AttributeMock, unittest.mock.Mock, ColourMixin, HashableMixin):
attribute_mocktype = unittest.mock.MagicMock
- def __init__(
- self,
- name: str = "role",
- role_id: int = 1,
- position: int = 1,
- **kwargs,
- ) -> None:
+ def __init__(self, name: str = "role", role_id: int = 1, position: int = 1, **kwargs) -> None:
super().__init__(spec=role_instance, **kwargs)
+
self.name = name
self.id = role_id
self.position = position
@@ -201,11 +196,14 @@ class MockMember(AttributeMock, unittest.mock.Mock, ColourMixin, HashableMixin):
**kwargs,
) -> None:
super().__init__(spec=member_instance, **kwargs)
+
self.name = name
self.id = user_id
+
self.roles = [MockRole("@everyone", 1)]
if roles:
self.roles.extend(roles)
+
self.mention = f"@{self.name}"
self.send = AsyncMock()