aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-01-24 18:32:10 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:54 -0800
commitdfd4ca2bf4d4b8717a648d3f291cc3daeeb762d4 (patch)
tree179b770ba95e4f6ae9f11bdff237852629bb8f86
parentSync tests: test sync edits message even if there's an API error (diff)
Sync tests: test _get_confirmation_result for small diffs
Should always return True and the given message if the diff size is too small.
-rw-r--r--tests/bot/cogs/sync/test_base.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py
index 314f8a70c..21f14f89a 100644
--- a/tests/bot/cogs/sync/test_base.py
+++ b/tests/bot/cogs/sync/test_base.py
@@ -351,3 +351,22 @@ class SyncerSyncTests(unittest.TestCase):
self.syncer._get_confirmation_result.assert_called_once()
self.assertEqual(self.syncer._get_confirmation_result.call_args[0][1], author)
self.assertEqual(self.syncer._get_confirmation_result.call_args[0][2], message)
+
+ def test_confirmation_result_small_diff(self):
+ """Should always return True and the given message if the diff size is too small."""
+ self.syncer.MAX_DIFF = 3
+ author = helpers.MockMember()
+ expected_message = helpers.MockMessage()
+
+ for size in (3, 2):
+ with self.subTest(size=size):
+ self.syncer._send_prompt = helpers.AsyncMock()
+ self.syncer._wait_for_confirmation = helpers.AsyncMock()
+
+ coro = self.syncer._get_confirmation_result(size, author, expected_message)
+ result, actual_message = asyncio.run(coro)
+
+ self.assertTrue(result)
+ self.assertEqual(actual_message, expected_message)
+ self.syncer._send_prompt.assert_not_called()
+ self.syncer._wait_for_confirmation.assert_not_called()