bot tests: Consistently use mock_bot_handler instance of MockClass.

This commit is contained in:
derAnfaenger 2017-11-01 12:56:42 +01:00 committed by showell
parent daad7f24e4
commit 979bbb1c14

View file

@ -102,18 +102,17 @@ class BotTestCaseBase(TestCase):
# Check if the bot is sending a message via `send_message` function. # Check if the bot is sending a message via `send_message` function.
# Where response is a dictionary here. # Where response is a dictionary here.
instance = self.MockClass.return_value
if expected_method == "send_message": if expected_method == "send_message":
instance.send_message.assert_called_with(response) self.mock_bot_handler.send_message.assert_called_with(response)
else: else:
instance.send_reply.assert_called_with(message, response['content']) self.mock_bot_handler.send_reply.assert_called_with(message, response['content'])
@contextmanager @contextmanager
def mock_config_info(self, config_info): def mock_config_info(self, config_info):
# type: (Dict[str, str]) -> Any # 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 yield
self.MockClass.return_value.get_config_info.return_value = None self.mock_bot_handler.get_config_info.return_value = None
@contextmanager @contextmanager
def mock_http_conversation(self, test_name): def mock_http_conversation(self, test_name):