aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-01-01 11:44:06 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:47 -0800
commit384a27d18ba258477239daa37569397092e26d76 (patch)
tree2c9cb1b2cb408088a589b0e63facac45eca4eb05 /tests
parentSync tests: fix creation of MockRoles (diff)
Sync tests: test empty diff for identical roles
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/sync/test_roles.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/bot/cogs/sync/test_roles.py b/tests/bot/cogs/sync/test_roles.py
index b1fe500cd..2a60e1fe2 100644
--- a/tests/bot/cogs/sync/test_roles.py
+++ b/tests/bot/cogs/sync/test_roles.py
@@ -1,3 +1,4 @@
+import asyncio
import unittest
import discord
@@ -27,15 +28,17 @@ class RoleSyncerTests(unittest.TestCase):
return guild
- def test_get_roles_for_sync_empty_return_for_equal_roles(self):
- """No roles should be synced when no diff is found."""
- api_roles = {Role(id=41, name='name', colour=33, permissions=0x8, position=1)}
- guild_roles = {Role(id=41, name='name', colour=33, permissions=0x8, position=1)}
+ 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.assertEqual(
- get_roles_for_sync(guild_roles, api_roles),
- (set(), set(), set())
- )
+ self.bot.api_client.get.return_value = [role]
+ guild = self.get_guild(role)
+
+ actual_diff = asyncio.run(self.syncer._get_diff(guild))
+ expected_diff = (set(), set(), set())
+
+ self.assertEqual(actual_diff, expected_diff)
def test_get_roles_for_sync_returns_roles_to_update_with_non_id_diff(self):
"""Roles to be synced are returned when non-ID attributes differ."""