Merge "Use *_as_ids instead *_as_list"

This commit is contained in:
Jenkins 2017-07-26 03:58:57 +00:00 committed by Gerrit Code Review
commit 86bda36963
2 changed files with 12 additions and 19 deletions

View File

@ -380,15 +380,8 @@ class ShowProject(command.ShowOne):
# identity manager.get() with kwargs directly.
project = identity_client.projects.get(
project.id,
parents_as_list=parsed_args.parents,
subtree_as_list=parsed_args.children)
if project._info.get('parents'):
project._info['parents'] = [str(p['project']['id'])
for p in project._info['parents']]
if project._info.get('subtree'):
project._info['subtree'] = [str(p['project']['id'])
for p in project._info['subtree']]
parents_as_ids=parsed_args.parents,
subtree_as_ids=parsed_args.children)
project._info.pop('links')
return zip(*sorted(six.iteritems(project._info)))

View File

@ -913,8 +913,8 @@ class TestProjectShow(TestProject):
self.projects_mock.get.assert_has_calls([call(self.project.id),
call(self.project.id,
parents_as_list=True,
subtree_as_list=False,
parents_as_ids=True,
subtree_as_ids=False,
)])
collist = (
@ -936,7 +936,7 @@ class TestProjectShow(TestProject):
self.project.is_domain,
self.project.name,
self.project.parent_id,
[self.project.parent_id],
[{'project': {'id': self.project.parent_id}}]
)
self.assertEqual(data, datalist)
@ -972,8 +972,8 @@ class TestProjectShow(TestProject):
columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_has_calls([call(self.project.id),
call(self.project.id,
parents_as_list=False,
subtree_as_list=True,
parents_as_ids=False,
subtree_as_ids=True,
)])
collist = (
@ -995,7 +995,7 @@ class TestProjectShow(TestProject):
self.project.is_domain,
self.project.name,
self.project.parent_id,
['children-id'],
[{'project': {'id': 'children-id'}}]
)
self.assertEqual(data, datalist)
@ -1033,8 +1033,8 @@ class TestProjectShow(TestProject):
columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.get.assert_has_calls([call(self.project.id),
call(self.project.id,
parents_as_list=True,
subtree_as_list=True,
parents_as_ids=True,
subtree_as_ids=True,
)])
collist = (
@ -1057,8 +1057,8 @@ class TestProjectShow(TestProject):
self.project.is_domain,
self.project.name,
self.project.parent_id,
[self.project.parent_id],
['children-id'],
[{'project': {'id': self.project.parent_id}}],
[{'project': {'id': 'children-id'}}]
)
self.assertEqual(data, datalist)