Improve test coverage for Mention bot.
This commit is contained in:
parent
bffb8d0e16
commit
fd97ffce77
|
@ -1,6 +1,7 @@
|
|||
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())
|
||||
|
|
Loading…
Reference in a new issue