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, available_bots: Optional[List[str]]=None,
bots_config: Optional[Dict[str, Dict[str, str]]]=None, bots_config: Optional[Dict[str, Dict[str, str]]]=None,
bot_handlers: Optional[Dict[str, Any]]=None, bot_handlers: Optional[Dict[str, Any]]=None,
message: Optional[Dict[str, Any]]=None, event: Optional[Dict[str, Any]]=None,
check_success: bool=False, check_success: bool=False,
third_party_bot_conf: Optional[configparser.ConfigParser]=None, third_party_bot_conf: Optional[configparser.ConfigParser]=None,
) -> None: ) -> None:
@ -31,7 +31,7 @@ class BotServerTestCase(TestCase):
server.app.config["BOT_HANDLERS"] = bot_handlers server.app.config["BOT_HANDLERS"] = bot_handlers
server.app.config["MESSAGE_HANDLERS"] = message_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: if check_success:
assert 200 <= response.status_code < 300 assert 200 <= response.status_code < 300

View file

@ -31,7 +31,7 @@ class BotServerTests(BotServerTestCase):
} }
self.assert_bot_server_response(available_bots=available_bots, self.assert_bot_server_response(available_bots=available_bots,
bots_config=bots_config, bots_config=bots_config,
message=dict(message={'content': "test message"}, event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'), bot_email='helloworld-bot@zulip.com'),
check_success=True) check_success=True)
@ -51,14 +51,14 @@ class BotServerTests(BotServerTestCase):
} }
} }
self.assert_bot_server_response(available_bots=available_bots, self.assert_bot_server_response(available_bots=available_bots,
message=dict(message={'content': "test message"}, event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'), bot_email='helloworld-bot@zulip.com'),
bots_config=bots_config, bots_config=bots_config,
check_success=True) check_success=True)
def test_bot_module_not_exists(self) -> None: def test_bot_module_not_exists(self) -> None:
self.assert_bot_server_response(available_bots=[], self.assert_bot_server_response(available_bots=[],
message=dict(message={'content': "test message"}, event=dict(message={'content': "test message"},
bot_email='nonexistent-bot@zulip.com'), bot_email='nonexistent-bot@zulip.com'),
check_success=False) check_success=False)
@ -81,7 +81,7 @@ class BotServerTests(BotServerTestCase):
"make sure you have set up the flaskbotrc file correctly.", "make sure you have set up the flaskbotrc file correctly.",
lambda: self.assert_bot_server_response( lambda: self.assert_bot_server_response(
available_bots=available_bots, available_bots=available_bots,
message=dict(message={'content': "test message"}, event=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'), bot_email='helloworld-bot@zulip.com'),
bots_config=bots_config)) bots_config=bots_config))