diff --git a/zulip_botserver/tests/server_test_lib.py b/zulip_botserver/tests/server_test_lib.py index 2edef9a..cb365c5 100644 --- a/zulip_botserver/tests/server_test_lib.py +++ b/zulip_botserver/tests/server_test_lib.py @@ -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 diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 1369d26..964922b 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -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'])