summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-07-31 17:33:17 +0000
committerGerrit Code Review <review@openstack.org>2015-07-31 17:33:17 +0000
commit9c640ae58ddb09ed1f3198784fed2cf57878e73a (patch)
tree3d799006eb7ea33592c6096cc9d4dbe99460d702
parent207e80c65c1deac72cfaaaeabd6dfd15f3377b30 (diff)
parent1c644d8dc12352b4b1f4ebb1700f9dcf029cbb4c (diff)
downloadpython-swiftclient-9c640ae58ddb09ed1f3198784fed2cf57878e73a.tar.gz
Merge "Test auth params together with --help option."
-rw-r--r--tests/unit/test_shell.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 8384f7a..17ac995 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -1271,9 +1271,19 @@ class TestParsing(TestBase):
# --help returns condensed help message, overrides --os-help
opts = {"help": ""}
os_opts = {"help": ""}
- # "password": "secret",
- # "username": "user",
- # "auth_url": "http://example.com:5000/v3"}
+ args = _make_args("", opts, os_opts)
+ with CaptureOutput() as out:
+ 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)
with CaptureOutput() as out:
self.assertRaises(SystemExit, swiftclient.shell.main, args)