diff options
author | Ondrej Novy <ondrej.novy@firma.seznam.cz> | 2015-07-30 09:24:49 +0200 |
---|---|---|
committer | Ondrej Novy <ondrej.novy@firma.seznam.cz> | 2015-07-30 09:48:00 +0200 |
commit | 1c644d8dc12352b4b1f4ebb1700f9dcf029cbb4c (patch) | |
tree | b962830fc5027e509cda2e501a0bde462a5d02ba | |
parent | 63998b481c7fd2d242efa12e2ca5b959bcdd113b (diff) | |
download | python-swiftclient-1c644d8dc12352b4b1f4ebb1700f9dcf029cbb4c.tar.gz |
Test auth params together with --help option.
Change-Id: I2691739cc14bb8d384cc7ef0f8a3e73d1b898f88
-rw-r--r-- | tests/unit/test_shell.py | 16 |
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) |