aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-01-27 22:00:11 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:55 -0800
commit32048b12d98d3b04a336ae53e12b81681a51e72a (patch)
tree1111867f46d27b47107b3f9106cfe3c7e7d48734
parentSync tests: test the extension setup (diff)
Sync tests: test Sync cog __init__
Should instantiate syncers and run a sync for the guild.
-rw-r--r--tests/bot/cogs/sync/test_cog.py21
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)