From 48f2c2ae365e1d7232573051329c5b6ee8b943ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20H=C3=B6nig?= Date: Mon, 28 May 2018 17:26:02 +0200 Subject: [PATCH] Remove default value from assert_bot_server_response `message` parameter. This is the first step in validating the bot responses for the botserver. The default value for `message` was nonsense and wouldn't trigger a bot in real life. Additionally, we'll want each test to use a proper message tailored to the test. Thus, this commit removes a 'default' message alltogether. --- zulip_botserver/tests/server_test_lib.py | 2 +- zulip_botserver/tests/test_server.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zulip_botserver/tests/server_test_lib.py b/zulip_botserver/tests/server_test_lib.py index bbe2eb4..2edef9a 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]]=dict(message={'key': "test message"}), + message: Optional[Dict[str, Any]]=None, check_success: bool=False, third_party_bot_conf: Optional[configparser.ConfigParser]=None, ) -> None: diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 7074d06..1369d26 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -79,8 +79,11 @@ class BotServerTests(BotServerTestCase): ImportError, "Bot \"nonexistent-bot\" doesn't exists. Please " "make sure you have set up the flaskbotrc file correctly.", - lambda: self.assert_bot_server_response(available_bots=available_bots, - bots_config=bots_config)) + lambda: self.assert_bot_server_response( + available_bots=available_bots, + message=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']) def test_argument_parsing_defaults(self) -> None: