Improve test coverage for Mention bot.
MODIFY
zulip_bots/zulip_bots/bots/mention/test_mention.py
zulip_bots/zulip_bots/bots/mention/test_mention.py
from zulip_bots.bots.mention.mention import MentionHandler
from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase
+from zulip_bots.test_lib import StubBotHandler
class TestMentionBot(BotTestCase):
bot_name = "mention"
@@ -43,3 +44,10 @@ class TestMentionBot(BotTestCase):
bot_response = bot_test_instance.get_mentions('TEST')[0]
self.assertEqual(bot_response['title'], 'TEST')
self.assertEqual(bot_response['original_url'], 'TEST')
+
+ def test_exception_when_api_key_is_invalid(self) -> None:
+ bot_test_instance = MentionHandler()
+
+ with self.mock_config_info({'access_token': 'TEST'}):
+ with self.assertRaises(StubBotHandler.BotQuitException):
+ bot_test_instance.initialize(StubBotHandler())

Improve test coverage for Mention bot.