aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-01-01 17:14:25 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:47 -0800
commitd9f6fc4c089814992f8c049cb2837e798390ea7d (patch)
treef964f6776dabdf3320ca0128af30cf986e862109 /tests
parentSync tests: test diff for updated roles (diff)
Sync tests: create a role in setUp to use as a constant
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/sync/test_roles.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/bot/cogs/sync/test_roles.py b/tests/bot/cogs/sync/test_roles.py
index 31bf13933..4eadf8f34 100644
--- a/tests/bot/cogs/sync/test_roles.py
+++ b/tests/bot/cogs/sync/test_roles.py
@@ -13,6 +13,7 @@ class RoleSyncerTests(unittest.TestCase):
def setUp(self):
self.bot = helpers.MockBot()
self.syncer = RoleSyncer(self.bot)
+ self.constant_role = {"id": 9, "name": "test", "colour": 7, "permissions": 0, "position": 3}
@staticmethod
def get_guild(*roles):
@@ -30,10 +31,8 @@ class RoleSyncerTests(unittest.TestCase):
def test_empty_diff_for_identical_roles(self):
"""No differences should be found if the roles in the guild and DB are identical."""
- role = {"id": 41, "name": "name", "colour": 33, "permissions": 0x8, "position": 1}
-
- self.bot.api_client.get.return_value = [role]
- guild = self.get_guild(role)
+ self.bot.api_client.get.return_value = [self.constant_role]
+ guild = self.get_guild(self.constant_role)
actual_diff = asyncio.run(self.syncer._get_diff(guild))
expected_diff = (set(), set(), set())
@@ -44,11 +43,11 @@ class RoleSyncerTests(unittest.TestCase):
"""Only updated roles should be added to the updated set of the diff."""
db_roles = [
{"id": 41, "name": "old", "colour": 33, "permissions": 0x8, "position": 1},
- {"id": 53, "name": "other", "colour": 55, "permissions": 0, "position": 3},
+ self.constant_role,
]
guild_roles = [
{"id": 41, "name": "new", "colour": 33, "permissions": 0x8, "position": 1},
- {"id": 53, "name": "other", "colour": 55, "permissions": 0, "position": 3},
+ self.constant_role,
]
self.bot.api_client.get.return_value = db_roles