Looks like get_arg_string() would improperly chop off the first two characters
of an argument that was passed in with one dash. For example,
passing '-option foo' would return 'tion foo' instead of 'option foo'.
Change-Id: Ib9aee601711b22c5243aca35f5c6196f494d23a9
Closes-Bug: #
1459453
# This is long optional arg
arg = args[2:]
else:
- arg = args[3:]
+ arg = args[1:]
else:
arg = args
service_get_all.assert_called_with(ctxt)
service_is_up.assert_called_with(service)
+ def test_get_arg_string(self):
+ args1 = "foobar"
+ args2 = "-foo bar"
+ args3 = "--foo bar"
+
+ self.assertEqual("foobar", cinder_manage.get_arg_string(args1))
+ self.assertEqual("foo bar", cinder_manage.get_arg_string(args2))
+ self.assertEqual("foo bar", cinder_manage.get_arg_string(args3))
+
@mock.patch('oslo_config.cfg.ConfigOpts.register_cli_opt')
def test_main_argv_lt_2(self, register_cli_opt):
script_name = 'cinder-manage'