Fixes CLI client called without subcommands
If CLI client is called without any subcommands or arguments it will fail with """'Namespace' object has no attribute 'command'""". This is coming from the getattr which does not have alternate value specified. Closes-Bug: #1494259 Change-Id: I461f0d4a91f3af2224bafc14a88572a8e4a3c051
This commit is contained in:
@@ -158,6 +158,13 @@ class ShellTest(testutils.TestCase):
|
||||
self.assertEqual(0, actual)
|
||||
self.assertFalse(et_mock.called)
|
||||
|
||||
def test_blank_call(self):
|
||||
shell = openstack_shell.OpenStackImagesShell()
|
||||
with mock.patch.object(shell, '_get_endpoint_and_token') as et_mock:
|
||||
actual = shell.main('')
|
||||
self.assertEqual(0, actual)
|
||||
self.assertFalse(et_mock.called)
|
||||
|
||||
def test_help_on_subcommand_error(self):
|
||||
self.assertRaises(exc.CommandError, shell,
|
||||
'--os-image-api-version 2 help bad')
|
||||
|
||||
Reference in New Issue
Block a user