test_lib : Add helper for connection test

This commit is contained in:
Dhruv Thakker 2018-03-07 22:34:05 +05:30 committed by showell
parent ea8393511a
commit 9ed47266aa

View file

@ -9,6 +9,7 @@ from zulip_bots.custom_exceptions import (
from zulip_bots.request_test_lib import ( from zulip_bots.request_test_lib import (
mock_http_conversation, mock_http_conversation,
mock_request_exception
) )
from zulip_bots.simple_lib import ( from zulip_bots.simple_lib import (
@ -182,6 +183,10 @@ class BotTestCase(TestCase):
http_data = read_bot_fixture_data(self.bot_name, test_name) http_data = read_bot_fixture_data(self.bot_name, test_name)
return mock_http_conversation(http_data) return mock_http_conversation(http_data)
def mock_request_exception(self):
# type: () -> Any
return mock_request_exception()
def mock_config_info(self, config_info): def mock_config_info(self, config_info):
# type: (Dict[str, str]) -> Any # type: (Dict[str, str]) -> Any
return patch('zulip_bots.test_lib.StubBotHandler.get_config_info', return_value=config_info) return patch('zulip_bots.test_lib.StubBotHandler.get_config_info', return_value=config_info)