From 979bbb1c14869b7986fb74b36778fe25a93c3d73 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Wed, 1 Nov 2017 12:56:42 +0100 Subject: [PATCH] bot tests: Consistently use mock_bot_handler instance of MockClass. --- zulip_bots/zulip_bots/test_lib.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zulip_bots/zulip_bots/test_lib.py b/zulip_bots/zulip_bots/test_lib.py index fea1e82..f0d6a49 100755 --- a/zulip_bots/zulip_bots/test_lib.py +++ b/zulip_bots/zulip_bots/test_lib.py @@ -102,18 +102,17 @@ class BotTestCaseBase(TestCase): # Check if the bot is sending a message via `send_message` function. # Where response is a dictionary here. - instance = self.MockClass.return_value if expected_method == "send_message": - instance.send_message.assert_called_with(response) + self.mock_bot_handler.send_message.assert_called_with(response) else: - instance.send_reply.assert_called_with(message, response['content']) + self.mock_bot_handler.send_reply.assert_called_with(message, response['content']) @contextmanager def mock_config_info(self, config_info): # type: (Dict[str, str]) -> Any - self.MockClass.return_value.get_config_info.return_value = config_info + self.mock_bot_handler.get_config_info.return_value = config_info yield - self.MockClass.return_value.get_config_info.return_value = None + self.mock_bot_handler.get_config_info.return_value = None @contextmanager def mock_http_conversation(self, test_name):