Decouple mock_request_exception from StubBotTestCase.
Tests that need mock_request_exception can just import it
directly now.
MODIFY
zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py
zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py
#!/usr/bin/env python
from zulip_bots.test_lib import StubBotTestCase
+from zulip_bots.request_test_lib import mock_request_exception
class TestWikipediaBot(StubBotTestCase):
bot_name = "wikipedia"
@@ -65,5 +66,5 @@ class TestWikipediaBot(StubBotTestCase):
# Request Exception
bot_request = 'Z'
bot_response = None
- with self.mock_request_exception():
+ with mock_request_exception():
self.verify_reply(bot_request, bot_response)

MODIFY
zulip_bots/zulip_bots/test_lib.py
zulip_bots/zulip_bots/test_lib.py
@@ -8,7 +8,6 @@ from typing import List, Dict, Any, Tuple
from zulip_bots.request_test_lib import (
mock_http_conversation,
- mock_request_exception,
)
from zulip_bots.simple_lib import (
@@ -164,10 +163,6 @@ class StubBotTestCase(TestCase):
http_data = read_bot_fixture_data(self.bot_name, test_name)
return mock_http_conversation(http_data)
- def mock_request_exception(self):
- # type: () -> Any
- return mock_request_exception()
-
def mock_config_info(self, config_info):
# type: (Dict[str, str]) -> Any
return patch('zulip_bots.test_lib.StubBotHandler.get_config_info', return_value=config_info)

Decouple mock_request_exception from StubBotTestCase.

Tests that need mock_request_exception can just import it
directly now.