diff options
| -rw-r--r-- | tests/bot/cogs/sync/test_cog.py | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/tests/bot/cogs/sync/test_cog.py b/tests/bot/cogs/sync/test_cog.py index fb0f044b0..efffaf53b 100644 --- a/tests/bot/cogs/sync/test_cog.py +++ b/tests/bot/cogs/sync/test_cog.py @@ -1,4 +1,5 @@  import unittest +from unittest import mock  from bot.cogs import sync  from tests import helpers @@ -13,3 +14,23 @@ class SyncExtensionTests(unittest.TestCase):          bot = helpers.MockBot()          sync.setup(bot)          bot.add_cog.assert_called_once() + + +class SyncCogTests(unittest.TestCase): +    """Tests for the Sync cog.""" + +    def setUp(self): +        self.bot = helpers.MockBot() + +    @mock.patch("bot.cogs.sync.syncers.RoleSyncer", autospec=True) +    @mock.patch("bot.cogs.sync.syncers.UserSyncer", autospec=True) +    def test_sync_cog_init(self, mock_role, mock_sync): +        """Should instantiate syncers and run a sync for the guild.""" +        mock_sync_guild_coro = mock.MagicMock() +        sync.Sync.sync_guild = mock.MagicMock(return_value=mock_sync_guild_coro) + +        sync.Sync(self.bot) + +        mock_role.assert_called_once_with(self.bot) +        mock_sync.assert_called_once_with(self.bot) +        self.bot.loop.create_task.assert_called_once_with(mock_sync_guild_coro) | 
