From 971b48cbfcb69e5e68a6f76370741029879bb172 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 11 Dec 2017 09:26:36 -0600 Subject: [PATCH] Decouple mock_request_exception from StubBotTestCase. Tests that need mock_request_exception can just import it directly now. --- zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py | 3 ++- zulip_bots/zulip_bots/test_lib.py | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py index 1cfeb57..bda2dd2 100755 --- a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py +++ b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py @@ -1,6 +1,7 @@ #!/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) diff --git a/zulip_bots/zulip_bots/test_lib.py b/zulip_bots/zulip_bots/test_lib.py index 82ea4d4..69afd67 100755 --- a/zulip_bots/zulip_bots/test_lib.py +++ b/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)