Rename assert_bot_server_response param message to event.

It's an event, not a message.
This commit is contained in:
Robert Hönig 2018-05-28 17:39:03 +02:00 committed by Tim Abbott
parent 48f2c2ae36
commit 27938a926b
2 changed files with 10 additions and 10 deletions

View file

@ -17,7 +17,7 @@ class BotServerTestCase(TestCase):
available_bots: Optional[List[str]]=None,
bots_config: Optional[Dict[str, Dict[str, str]]]=None,
bot_handlers: Optional[Dict[str, Any]]=None,
message: Optional[Dict[str, Any]]=None,
event: Optional[Dict[str, Any]]=None,
check_success: bool=False,
third_party_bot_conf: Optional[configparser.ConfigParser]=None,
) -> None:
@ -31,7 +31,7 @@ class BotServerTestCase(TestCase):
server.app.config["BOT_HANDLERS"] = bot_handlers
server.app.config["MESSAGE_HANDLERS"] = message_handlers
response = self.app.post(data=json.dumps(message))
response = self.app.post(data=json.dumps(event))
if check_success:
assert 200 <= response.status_code < 300

View file

@ -31,8 +31,8 @@ class BotServerTests(BotServerTestCase):
}
self.assert_bot_server_response(available_bots=available_bots,
bots_config=bots_config,
message=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
check_success=True)
@mock.patch('zulip_bots.lib.ExternalBotHandler')
@ -51,15 +51,15 @@ class BotServerTests(BotServerTestCase):
}
}
self.assert_bot_server_response(available_bots=available_bots,
message=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
bots_config=bots_config,
check_success=True)
def test_bot_module_not_exists(self) -> None:
self.assert_bot_server_response(available_bots=[],
message=dict(message={'content': "test message"},
bot_email='nonexistent-bot@zulip.com'),
event=dict(message={'content': "test message"},
bot_email='nonexistent-bot@zulip.com'),
check_success=False)
@mock.patch('logging.error')
@ -81,8 +81,8 @@ class BotServerTests(BotServerTestCase):
"make sure you have set up the flaskbotrc file correctly.",
lambda: self.assert_bot_server_response(
available_bots=available_bots,
message=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
bots_config=bots_config))
@mock.patch('sys.argv', ['zulip-bot-server', '--config-file', '/foo/bar/baz.conf'])