From 40785d3116221fd7b4e4b64a0332d49f6f8c6eef Mon Sep 17 00:00:00 2001 From: dkvasov Date: Thu, 17 May 2018 18:41:31 +0300 Subject: [PATCH] zulip_botserver: Add test for default input parameters. --- zulip_botserver/tests/test_server.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 38d51c2..54fefb7 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -4,6 +4,8 @@ import unittest from .server_test_lib import BotServerTestCase import six +from zulip_botserver.input_parameters import parse_args + class BotServerTests(BotServerTestCase): class MockMessageHandler(object): @@ -72,5 +74,15 @@ class BotServerTests(BotServerTestCase): lambda: self.assert_bot_server_response(available_bots=available_bots, bots_config=bots_config)) + @mock.patch('sys.argv', ['zulip-bot-server', '--config-file', '/foo/bar/baz.conf']) + def test_argument_parsing_defaults(self) -> None: + opts = parse_args() + assert opts.config_file == '/foo/bar/baz.conf' + assert opts.bot_name is None + assert opts.bot_config_file is None + assert opts.hostname == '127.0.0.1' + assert opts.port == 5002 + + if __name__ == '__main__': unittest.main()