Merge "Fix condition in CheckSizeArgForCreate parser action"
This commit is contained in:
@@ -334,6 +334,13 @@ class ShellTest(utils.TestCase):
|
||||
def test_create_size_required_if_not_snapshot_or_clone(self):
|
||||
self.assertRaises(SystemExit, self.run_command, 'create')
|
||||
|
||||
def test_create_size_zero_if_not_snapshot_or_clone(self):
|
||||
expected = {'volume': {'status': 'creating',
|
||||
'size': 0}}
|
||||
self.run_command('create 0')
|
||||
self.assert_called_anytime('POST', '/volumes', partial_body=expected)
|
||||
self.assert_called('GET', '/volumes/1234')
|
||||
|
||||
def test_show(self):
|
||||
self.run_command('show 1234')
|
||||
self.assert_called('GET', '/volumes/1234')
|
||||
|
||||
@@ -261,8 +261,8 @@ def do_show(cs, args):
|
||||
|
||||
class CheckSizeArgForCreate(argparse.Action):
|
||||
def __call__(self, parser, args, values, option_string=None):
|
||||
if (values or args.snapshot_id or args.source_volid
|
||||
or args.source_replica) is None:
|
||||
if ((args.snapshot_id or args.source_volid or args.source_replica)
|
||||
is None and values is None):
|
||||
parser.error('Size is a required parameter if snapshot '
|
||||
'or source volume is not specified.')
|
||||
setattr(args, self.dest, values)
|
||||
|
||||
Reference in New Issue
Block a user