summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit/test_shell.py
diff options
context:
space:
mode:
authorCyril Roelandt <cyril@redhat.com>2021-06-23 23:18:49 +0200
committerAbhishek Kekane <akekane@redhat.com>2021-12-14 15:14:10 +0000
commit91ae9347dbc125a19fedd107df5cc013e018e7e1 (patch)
treea6c1e081845ec31e746525427927d5d37450b8c6 /glanceclient/tests/unit/test_shell.py
parent8aac1597cd1cb8c989b8939d89891b459cfbe4f9 (diff)
downloadpython-glanceclient-91ae9347dbc125a19fedd107df5cc013e018e7e1.tar.gz
glance help <subcommand>: Clearly specify which options are mandatory
Earlier glance help <subcommand> was listing required arguments as optional arguments in help text. Added new argument group to list required argument properly. $ glance help stores-delete Example before this change: usage: glance stores-delete --store <STORE_ID> <IMAGE_ID> Delete image from specific store. Positional arguments: <IMAGE_ID> ID of image to update. Optional arguments: --store <STORE_ID> Store to delete image from. After this change: usage: glance stores-delete --store <STORE_ID> <IMAGE_ID> Delete image from specific store. Positional arguments: <IMAGE_ID> ID of image to update. Required arguments: --store <STORE_ID> Store to delete image from. Change-Id: I51ea4c43fa62164ed43e78d1ae0fb0cb2521fc83 Closes-Bug: #1933390
Diffstat (limited to 'glanceclient/tests/unit/test_shell.py')
-rw-r--r--glanceclient/tests/unit/test_shell.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/test_shell.py b/glanceclient/tests/unit/test_shell.py
index 129b127..6b9472e 100644
--- a/glanceclient/tests/unit/test_shell.py
+++ b/glanceclient/tests/unit/test_shell.py
@@ -600,6 +600,17 @@ class ShellTest(testutils.TestCase):
self.assertEqual(glance_logger.getEffectiveLevel(), logging.DEBUG)
conf.assert_called_with(level=logging.DEBUG)
+ def test_subcommand_help(self):
+ # Ensure that main works with sub command help
+ stdout, stderr = self.shell('help stores-delete')
+
+ expected = 'usage: glance stores-delete --store <STORE_ID> ' \
+ '<IMAGE_ID>\n\nDelete image from specific store.' \
+ '\n\nPositional arguments:\n <IMAGE_ID> ' \
+ 'ID of image to update.\n\nRequired arguments:\n ' \
+ '--store <STORE_ID> Store to delete image from.\n'
+ self.assertEqual(expected, stdout)
+
class ShellTestWithKeystoneV3Auth(ShellTest):
# auth environment to use