From a6f01dbd55aef97a39f615348ea22b62a59f2c70 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Sun, 5 Jan 2020 10:44:14 -0800 Subject: Sync tests: test _send_prompt fetches channel on a cache miss --- tests/bot/cogs/sync/test_base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3