Browse Source

Merge "Bugfix: Use fields option for cluster template list"

tags/3.0.0
Zuul 4 months ago
committed by Gerrit Code Review
parent
commit
18f5928215
2 changed files with 7 additions and 3 deletions
  1. +2
    -0
      magnumclient/osc/v1/cluster_templates.py
  2. +5
    -3
      magnumclient/tests/osc/unit/v1/test_cluster_templates.py

+ 2
- 0
magnumclient/osc/v1/cluster_templates.py View File

@@ -354,6 +354,8 @@ class ListTemplateCluster(command.Lister):

mag_client = self.app.client_manager.container_infra
columns = ['uuid', 'name']
if parsed_args.fields:
columns += parsed_args.fields.split(',')
cts = mag_client.cluster_templates.list(limit=parsed_args.limit,
sort_key=parsed_args.sort_key,
sort_dir=parsed_args.sort_dir)


+ 5
- 3
magnumclient/tests/osc/unit/v1/test_cluster_templates.py View File

@@ -271,22 +271,24 @@ class TestClusterTemplateList(TestClusterTemplate):
'--limit', '1',
'--sort-key', 'key',
'--sort-dir', 'asc',
'--fields', 'fields'
'--fields', 'field1,field2'
]
verifylist = [
('limit', 1),
('sort_key', 'key'),
('sort_dir', 'asc'),
('fields', 'fields'),
('fields', 'field1,field2'),
]
verifycolumns = self.columns + ['field1', 'field2']
parsed_args = self.check_parser(self.cmd, arglist, verifylist)

self.cmd.take_action(parsed_args)
columns, data = self.cmd.take_action(parsed_args)
self.cluster_templates_mock.list.assert_called_with(
limit=1,
sort_dir='asc',
sort_key='key',
)
self.assertEqual(verifycolumns, columns)

def test_cluster_template_list_bad_sort_dir_fail(self):
arglist = [


Loading…
Cancel
Save