diff options
| author | 2020-01-05 10:44:14 -0800 | |
|---|---|---|
| committer | 2020-02-12 10:07:51 -0800 | |
| commit | a6f01dbd55aef97a39f615348ea22b62a59f2c70 (patch) | |
| tree | f80bba6d992df8be4170af6f919a0cd246f89e2f | |
| parent | Sync tests: test that _send_prompt gets channel from cache (diff) | |
Sync tests: test _send_prompt fetches channel on a cache miss
| -rw-r--r-- | tests/bot/cogs/sync/test_base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py index 9b177f25c..c18fa5fbb 100644 --- a/tests/bot/cogs/sync/test_base.py +++ b/tests/bot/cogs/sync/test_base.py @@ -43,3 +43,14 @@ class SyncerBaseTests(unittest.TestCase): asyncio.run(self.syncer._send_prompt()) self.bot.get_channel.assert_called_once_with(constants.Channels.devcore) + + def test_send_prompt_fetches_channel_if_cache_miss(self): + """The dev-core channel should be fetched with an API call if it's not in the cache.""" + self.bot.get_channel.return_value = None + mock_channel = helpers.MockTextChannel() + mock_channel.send.return_value = helpers.MockMessage() + self.bot.fetch_channel.return_value = mock_channel + + asyncio.run(self.syncer._send_prompt()) + + self.bot.fetch_channel.assert_called_once_with(constants.Channels.devcore) |