Skip to content

Commit 86bda36

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Use *_as_ids instead *_as_list"
2 parents f67ebce + a98d369 commit 86bda36

2 files changed

Lines changed: 12 additions & 19 deletions

File tree

openstackclient/identity/v3/project.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,8 @@ def take_action(self, parsed_args):
380380
# identity manager.get() with kwargs directly.
381381
project = identity_client.projects.get(
382382
project.id,
383-
parents_as_list=parsed_args.parents,
384-
subtree_as_list=parsed_args.children)
385-
386-
if project._info.get('parents'):
387-
project._info['parents'] = [str(p['project']['id'])
388-
for p in project._info['parents']]
389-
if project._info.get('subtree'):
390-
project._info['subtree'] = [str(p['project']['id'])
391-
for p in project._info['subtree']]
383+
parents_as_ids=parsed_args.parents,
384+
subtree_as_ids=parsed_args.children)
392385

393386
project._info.pop('links')
394387
return zip(*sorted(six.iteritems(project._info)))

openstackclient/tests/unit/identity/v3/test_project.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,8 @@ def test_project_show_parents(self):
913913

914914
self.projects_mock.get.assert_has_calls([call(self.project.id),
915915
call(self.project.id,
916-
parents_as_list=True,
917-
subtree_as_list=False,
916+
parents_as_ids=True,
917+
subtree_as_ids=False,
918918
)])
919919

920920
collist = (
@@ -936,7 +936,7 @@ def test_project_show_parents(self):
936936
self.project.is_domain,
937937
self.project.name,
938938
self.project.parent_id,
939-
[self.project.parent_id],
939+
[{'project': {'id': self.project.parent_id}}]
940940
)
941941
self.assertEqual(data, datalist)
942942

@@ -972,8 +972,8 @@ def test_project_show_subtree(self):
972972
columns, data = self.cmd.take_action(parsed_args)
973973
self.projects_mock.get.assert_has_calls([call(self.project.id),
974974
call(self.project.id,
975-
parents_as_list=False,
976-
subtree_as_list=True,
975+
parents_as_ids=False,
976+
subtree_as_ids=True,
977977
)])
978978

979979
collist = (
@@ -995,7 +995,7 @@ def test_project_show_subtree(self):
995995
self.project.is_domain,
996996
self.project.name,
997997
self.project.parent_id,
998-
['children-id'],
998+
[{'project': {'id': 'children-id'}}]
999999
)
10001000
self.assertEqual(data, datalist)
10011001

@@ -1033,8 +1033,8 @@ def test_project_show_parents_and_children(self):
10331033
columns, data = self.cmd.take_action(parsed_args)
10341034
self.projects_mock.get.assert_has_calls([call(self.project.id),
10351035
call(self.project.id,
1036-
parents_as_list=True,
1037-
subtree_as_list=True,
1036+
parents_as_ids=True,
1037+
subtree_as_ids=True,
10381038
)])
10391039

10401040
collist = (
@@ -1057,8 +1057,8 @@ def test_project_show_parents_and_children(self):
10571057
self.project.is_domain,
10581058
self.project.name,
10591059
self.project.parent_id,
1060-
[self.project.parent_id],
1061-
['children-id'],
1060+
[{'project': {'id': self.project.parent_id}}],
1061+
[{'project': {'id': 'children-id'}}]
10621062
)
10631063
self.assertEqual(data, datalist)
10641064

0 commit comments

Comments
 (0)