Merge "Relax requirement of region-id for hosts and cells"
This commit is contained in:
commit
c558ab65cf
@ -32,7 +32,6 @@ def do_cell_show(cc, args):
|
|||||||
@cliutils.arg('-r', '--region',
|
@cliutils.arg('-r', '--region',
|
||||||
metavar='<region>',
|
metavar='<region>',
|
||||||
type=int,
|
type=int,
|
||||||
required=True,
|
|
||||||
help='ID of the region that the cell belongs to.')
|
help='ID of the region that the cell belongs to.')
|
||||||
@cliutils.arg('--cloud',
|
@cliutils.arg('--cloud',
|
||||||
metavar='<cloud>',
|
metavar='<cloud>',
|
||||||
@ -110,8 +109,10 @@ def do_cell_list(cc, args):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
params['sort_key'] = sort_key
|
params['sort_key'] = sort_key
|
||||||
|
if args.region is not None:
|
||||||
|
params['region_id'] = args.region
|
||||||
|
|
||||||
params['sort_dir'] = args.sort_dir
|
params['sort_dir'] = args.sort_dir
|
||||||
params['region_id'] = args.region
|
|
||||||
params['marker'] = args.marker
|
params['marker'] = args.marker
|
||||||
params['autopaginate'] = args.all
|
params['autopaginate'] = args.all
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ def do_host_show(cc, args):
|
|||||||
@cliutils.arg('-r', '--region',
|
@cliutils.arg('-r', '--region',
|
||||||
metavar='<region>',
|
metavar='<region>',
|
||||||
type=int,
|
type=int,
|
||||||
required=True,
|
|
||||||
help='ID of the region that the host belongs to.')
|
help='ID of the region that the host belongs to.')
|
||||||
@cliutils.arg('--cloud',
|
@cliutils.arg('--cloud',
|
||||||
metavar='<cloud>',
|
metavar='<cloud>',
|
||||||
@ -140,8 +139,10 @@ def do_host_list(cc, args):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
params['sort_key'] = sort_key
|
params['sort_key'] = sort_key
|
||||||
|
if args.region is not None:
|
||||||
|
params['region_id'] = args.region
|
||||||
|
|
||||||
params['sort_dir'] = args.sort_dir
|
params['sort_dir'] = args.sort_dir
|
||||||
params['region_id'] = args.region
|
|
||||||
params['marker'] = args.marker
|
params['marker'] = args.marker
|
||||||
params['autopaginate'] = args.all
|
params['autopaginate'] = args.all
|
||||||
|
|
||||||
|
@ -163,6 +163,17 @@ class TestCellsShell(base.ShellTestCase):
|
|||||||
marker=None,
|
marker=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('cratonclient.v1.cells.CellManager.list')
|
||||||
|
def test_cell_list_does_not_require_region_id(self, cell_list):
|
||||||
|
"""Verify -r/--region are not required to list cells."""
|
||||||
|
self.shell('cell-list --limit 10')
|
||||||
|
cell_list.assert_called_once_with(
|
||||||
|
sort_dir='asc',
|
||||||
|
autopaginate=False,
|
||||||
|
limit=10,
|
||||||
|
marker=None,
|
||||||
|
)
|
||||||
|
|
||||||
def test_cell_list_sort_dir_invalid_value(self):
|
def test_cell_list_sort_dir_invalid_value(self):
|
||||||
"""Verify --sort-dir with invalid args, fails with Command Error."""
|
"""Verify --sort-dir with invalid args, fails with Command Error."""
|
||||||
(_, error) = self.shell(
|
(_, error) = self.shell(
|
||||||
|
@ -93,6 +93,17 @@ class TestHostsShell(base.ShellTestCase):
|
|||||||
autopaginate=False,
|
autopaginate=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('cratonclient.v1.hosts.HostManager.list')
|
||||||
|
def test_host_list_does_not_require_region(self, host_list):
|
||||||
|
"""Verify -r/--region is not required to list hosts."""
|
||||||
|
self.shell('host-list --limit 10')
|
||||||
|
host_list.assert_called_once_with(
|
||||||
|
limit=10,
|
||||||
|
sort_dir='asc',
|
||||||
|
marker=None,
|
||||||
|
autopaginate=False,
|
||||||
|
)
|
||||||
|
|
||||||
def test_host_list_limit_negative_num_failure(self):
|
def test_host_list_limit_negative_num_failure(self):
|
||||||
"""Verify --limit X, where X is a negative integer, fails.
|
"""Verify --limit X, where X is a negative integer, fails.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user