summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorShashirekha Gundur <shashirekha.j.gundur@intel.com>2016-10-23 19:59:11 +0000
committerShashirekha Gundur <shashirekha.j.gundur@intel.com>2016-12-13 13:41:08 +0000
commit41666d60c88e4b70bceb7898459a93e6cf389382 (patch)
tree179d605e0cf8c546121d588277a01cc0fb32c679 /tests
parenta0d1fe04bc9f9566986b0496a78562b5ec4702e1 (diff)
downloadpython-swiftclient-41666d60c88e4b70bceb7898459a93e6cf389382.tar.gz
modify 'swift <sub_command> —help' display
In python swiftclient: swift <sub_command> —help will now display st_<sub_command>_options + st_<sub_command>_help texts e.g. http://paste.openstack.org/show/589752/ Change-Id: I34e4b2ac29ef395f8ca474ce7a82f59a1fd8c7f4 Closes-Bug: #1621415
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_shell.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 718615d..70ac696 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -1545,18 +1545,21 @@ class TestSubcommandHelp(unittest.TestCase):
def test_subcommand_help(self):
for command in swiftclient.shell.commands:
help_var = 'st_%s_help' % command
+ options_var = 'st_%s_options' % command
self.assertTrue(hasattr(swiftclient.shell, help_var))
with CaptureOutput() as out:
argv = ['', command, '--help']
self.assertRaises(SystemExit, swiftclient.shell.main, argv)
- expected = vars(swiftclient.shell)[help_var]
+ expected = 'Usage: swift %s %s\n%s' % (
+ command, vars(swiftclient.shell).get(options_var, "\n"),
+ vars(swiftclient.shell)[help_var])
self.assertEqual(out.strip('\n'), expected)
def test_no_help(self):
with CaptureOutput() as out:
argv = ['', 'bad_command', '--help']
self.assertRaises(SystemExit, swiftclient.shell.main, argv)
- expected = 'no help for bad_command'
+ expected = 'no such command: bad_command'
self.assertEqual(out.strip('\n'), expected)