Decouple mock_request_exception from StubBotTestCase.
Tests that need mock_request_exception can just import it directly now.
This commit is contained in:
parent
1dbb73a1c8
commit
971b48cbfc
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from zulip_bots.test_lib import StubBotTestCase
|
from zulip_bots.test_lib import StubBotTestCase
|
||||||
|
from zulip_bots.request_test_lib import mock_request_exception
|
||||||
|
|
||||||
class TestWikipediaBot(StubBotTestCase):
|
class TestWikipediaBot(StubBotTestCase):
|
||||||
bot_name = "wikipedia"
|
bot_name = "wikipedia"
|
||||||
|
@ -65,5 +66,5 @@ class TestWikipediaBot(StubBotTestCase):
|
||||||
# Request Exception
|
# Request Exception
|
||||||
bot_request = 'Z'
|
bot_request = 'Z'
|
||||||
bot_response = None
|
bot_response = None
|
||||||
with self.mock_request_exception():
|
with mock_request_exception():
|
||||||
self.verify_reply(bot_request, bot_response)
|
self.verify_reply(bot_request, bot_response)
|
||||||
|
|
|
@ -8,7 +8,6 @@ from typing import List, Dict, Any, Tuple
|
||||||
|
|
||||||
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 (
|
||||||
|
@ -164,10 +163,6 @@ class StubBotTestCase(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)
|
||||||
|
|
Loading…
Reference in a new issue