aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bot/cogs/sync/test_base.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py
index ae8e53ffa..dfc8320d2 100644
--- a/tests/bot/cogs/sync/test_base.py
+++ b/tests/bot/cogs/sync/test_base.py
@@ -249,7 +249,7 @@ class SyncerSyncTests(unittest.TestCase):
"""Tests for main function orchestrating the sync."""
def setUp(self):
- self.bot = helpers.MockBot()
+ self.bot = helpers.MockBot(user=helpers.MockMember(bot=True))
self.syncer = TestSyncer(self.bot)
def test_sync_respects_confirmation_result(self):
@@ -318,3 +318,21 @@ class SyncerSyncTests(unittest.TestCase):
if message is not None:
message.edit.assert_called_once()
self.assertIn("content", message.edit.call_args[1])
+
+ def test_sync_confirmation_author(self):
+ """Author should be the bot or the ctx author, if a ctx is given."""
+ mock_member = helpers.MockMember()
+ subtests = (
+ (None, self.bot.user),
+ (helpers.MockContext(author=mock_member), mock_member),
+ )
+
+ for ctx, author in subtests:
+ with self.subTest(ctx=ctx, author=author):
+ self.syncer._get_confirmation_result = helpers.AsyncMock(return_value=(False, None))
+
+ guild = helpers.MockGuild()
+ asyncio.run(self.syncer.sync(guild, ctx))
+
+ self.syncer._get_confirmation_result.assert_called_once()
+ self.assertEqual(self.syncer._get_confirmation_result.call_args[0][1], author)