diff options
author | 2020-01-07 11:18:35 -0800 | |
---|---|---|
committer | 2020-02-12 10:07:52 -0800 | |
commit | cc8ecb9fd52b24e323c4e6f5ce8a2ddcc8d31777 (patch) | |
tree | 28ee37040481744445a18674215c66f0b583677f /tests | |
parent | Sync tests: use channel fixtures with subtests (diff) |
Sync tests: use channel fixtures with subtests in add reaction test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bot/cogs/sync/test_base.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py index d46965738..e0a3f4127 100644 --- a/tests/bot/cogs/sync/test_base.py +++ b/tests/bot/cogs/sync/test_base.py @@ -97,8 +97,19 @@ class SyncerBaseTests(unittest.TestCase): def test_send_prompt_adds_reactions(self): """The message should have reactions for confirmation added.""" - msg = helpers.MockMessage() - asyncio.run(self.syncer._send_prompt(msg)) + extant_message = helpers.MockMessage() + subtests = ( + (extant_message, lambda: (None, extant_message)), + (None, self.mock_get_channel), + (None, self.mock_fetch_channel), + ) + + for message_arg, mock_ in subtests: + subtest_msg = "Extant message" if mock_.__name__ == "<lambda>" else mock_.__name__ + + with self.subTest(msg=subtest_msg): + _, mock_message = mock_() + asyncio.run(self.syncer._send_prompt(message_arg)) - calls = [mock.call(emoji) for emoji in self.syncer._REACTION_EMOJIS] - msg.add_reaction.assert_has_calls(calls) + calls = [mock.call(emoji) for emoji in self.syncer._REACTION_EMOJIS] + mock_message.add_reaction.assert_has_calls(calls) |