From fd97ffce77a2b97de42412bcaec40892c90544e2 Mon Sep 17 00:00:00 2001 From: Viraat Chandra Date: Sat, 6 Jan 2018 20:56:21 +0530 Subject: [PATCH] Improve test coverage for Mention bot. --- zulip_bots/zulip_bots/bots/mention/test_mention.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zulip_bots/zulip_bots/bots/mention/test_mention.py b/zulip_bots/zulip_bots/bots/mention/test_mention.py index ac5a4bf..ee72393 100644 --- a/zulip_bots/zulip_bots/bots/mention/test_mention.py +++ b/zulip_bots/zulip_bots/bots/mention/test_mention.py @@ -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())