aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-25 14:08:34 -0700
committerGravatar MarkKoz <[email protected]>2020-03-25 14:16:17 -0700
commitc3e9a290a93c978a4dfec3ab121a0e45147855c8 (patch)
treed7dc10d3939a65b1a4c27d27f1209ee7ee40b671
parentSnekbox tests: test `get_code` (diff)
Snekbox tests: use `get_code` in `test_continue_eval_does_continue`
-rw-r--r--tests/bot/cogs/test_snekbox.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/bot/cogs/test_snekbox.py b/tests/bot/cogs/test_snekbox.py
index 1fad6904b..1dec0ccaf 100644
--- a/tests/bot/cogs/test_snekbox.py
+++ b/tests/bot/cogs/test_snekbox.py
@@ -1,7 +1,7 @@
import asyncio
import logging
import unittest
-from unittest.mock import AsyncMock, MagicMock, Mock, call, patch
+from unittest.mock import AsyncMock, MagicMock, Mock, call, create_autospec, patch
from discord.ext import commands
@@ -281,11 +281,14 @@ class SnekboxTests(unittest.IsolatedAsyncioTestCase):
"""Test that the continue_eval function does continue if required conditions are met."""
ctx = MockContext(message=MockMessage(add_reaction=AsyncMock(), clear_reactions=AsyncMock()))
response = MockMessage(delete=AsyncMock())
- new_msg = MockMessage(content='!e NewCode')
+ new_msg = MockMessage()
self.bot.wait_for.side_effect = ((None, new_msg), None)
+ expected = "NewCode"
+ self.cog.get_code = create_autospec(self.cog.get_code, spec_set=True, return_value=expected)
actual = await self.cog.continue_eval(ctx, response)
- self.assertEqual(actual, 'NewCode')
+ self.cog.get_code.assert_awaited_once_with(new_msg)
+ self.assertEqual(actual, expected)
self.bot.wait_for.assert_has_awaits(
(
call('message_edit', check=partial_mock(snekbox.predicate_eval_message_edit, ctx), timeout=10),