diff options
author | 2022-04-18 17:39:20 +0100 | |
---|---|---|
committer | 2022-04-18 17:47:29 +0100 | |
commit | 87edeff7347f011c2317cd4b3681bea5bbe07185 (patch) | |
tree | 1e1e98ae432816520313b85eb140a035bdcffab5 | |
parent | Refactor otn cog to use discord.py tasks (diff) |
Test that sync cog syncers run when sync cog is loaded
-rw-r--r-- | tests/bot/exts/backend/sync/test_cog.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/bot/exts/backend/sync/test_cog.py b/tests/bot/exts/backend/sync/test_cog.py index 28afeebeb..87b76c6b4 100644 --- a/tests/bot/exts/backend/sync/test_cog.py +++ b/tests/bot/exts/backend/sync/test_cog.py @@ -60,6 +60,19 @@ class SyncCogTestCase(unittest.IsolatedAsyncioTestCase): class SyncCogTests(SyncCogTestCase): """Tests for the Sync cog.""" + async def test_sync_cog_sync_on_load(self): + """Roles and users should be synced on cog load.""" + guild = helpers.MockGuild() + self.bot.get_guild = mock.MagicMock(return_value=guild) + + self.RoleSyncer.reset_mock() + self.UserSyncer.reset_mock() + + await self.cog.cog_load() + + self.RoleSyncer.sync.assert_called_once_with(guild) + self.UserSyncer.sync.assert_called_once_with(guild) + async def test_sync_cog_sync_guild(self): """Roles and users should be synced only if a guild is successfully retrieved.""" for guild in (helpers.MockGuild(), None): |