Merge "Test auth params together with --help option."

This commit is contained in:
Jenkins
2015-07-31 17:33:17 +00:00
committed by Gerrit Code Review

View File

@@ -1271,9 +1271,19 @@ class TestParsing(TestBase):
# --help returns condensed help message, overrides --os-help # --help returns condensed help message, overrides --os-help
opts = {"help": ""} opts = {"help": ""}
os_opts = {"help": ""} os_opts = {"help": ""}
# "password": "secret", args = _make_args("", opts, os_opts)
# "username": "user", with CaptureOutput() as out:
# "auth_url": "http://example.com:5000/v3"} self.assertRaises(SystemExit, swiftclient.shell.main, args)
self.assertTrue(out.find('[--key <api_key>]') > 0)
self.assertEqual(-1, out.find('--os-username=<auth-user-name>'))
# --os-password, --os-username and --os-auth_url should be ignored
# because --help overrides it
opts = {"help": ""}
os_opts = {"help": "",
"password": "secret",
"username": "user",
"auth_url": "http://example.com:5000/v3"}
args = _make_args("", opts, os_opts) args = _make_args("", opts, os_opts)
with CaptureOutput() as out: with CaptureOutput() as out:
self.assertRaises(SystemExit, swiftclient.shell.main, args) self.assertRaises(SystemExit, swiftclient.shell.main, args)