diff options
| author | 2020-01-07 09:56:34 -0800 | |
|---|---|---|
| committer | 2020-02-12 10:07:51 -0800 | |
| commit | 0fdd675f5bc85a20268e257e073d9605126ee322 (patch) | |
| tree | ec753b31e9625bb4d9dbb88532e08ddd3015bd93 /tests | |
| parent | Sync tests: test _send_prompt adds reactions (diff) | |
Sync tests: add fixtures to mock dev core channel get and fetch
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bot/cogs/sync/test_base.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py index e509b3c98..2c6857246 100644 --- a/tests/bot/cogs/sync/test_base.py +++ b/tests/bot/cogs/sync/test_base.py @@ -24,6 +24,27 @@ class SyncerBaseTests(unittest.TestCase): self.bot = helpers.MockBot() self.syncer = TestSyncer(self.bot) + def mock_dev_core_channel(self): + """Fixture to return a mock channel and message for when `get_channel` is used.""" + mock_channel = helpers.MockTextChannel() + mock_message = helpers.MockMessage() + + mock_channel.send.return_value = mock_message + self.bot.get_channel.return_value = mock_channel + + return mock_channel, mock_message + + def mock_dev_core_channel_cache_miss(self): + """Fixture to return a mock channel and message for when `fetch_channel` is used.""" + mock_channel = helpers.MockTextChannel() + mock_message = helpers.MockMessage() + + self.bot.get_channel.return_value = None + mock_channel.send.return_value = mock_message + self.bot.fetch_channel.return_value = mock_channel + + return mock_channel, mock_message + def test_instantiation_fails_without_abstract_methods(self): """The class must have abstract methods implemented.""" with self.assertRaisesRegex(TypeError, "Can't instantiate abstract class"): |