zulip_botserver: Add test for default input parameters.

This commit is contained in:
dkvasov 2018-05-17 18:41:31 +03:00 committed by Tim Abbott
parent 0040182ec4
commit 40785d3116

View file

@ -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()