diff options
| author | Rui Chen <chenrui.momo@gmail.com> | 2017-02-09 17:25:36 +0800 |
|---|---|---|
| committer | Rui Chen <chenrui.momo@gmail.com> | 2017-02-09 19:24:55 +0800 |
| commit | 4679a4c1933da0b94efb5d3d453d119801289a97 (patch) | |
| tree | 4a2a41ff6969cb36a8cba3f37d345a10b52e0a64 /openstackclient/tests/unit/identity | |
| parent | 2966bd0639bba203f1f46216b52a41e7a6596375 (diff) | |
| download | python-openstackclient-4679a4c1933da0b94efb5d3d453d119801289a97.tar.gz | |
Fix --parents and --children options in project show
Options "--parents" and "--children" don't work in "project show"
command, fix the issue and add related unit and functional tests.
Change-Id: Id9965267a037442f1077f8e1929d0527981f643d
Closes-Bug: #1499657
Diffstat (limited to 'openstackclient/tests/unit/identity')
| -rw-r--r-- | openstackclient/tests/unit/identity/v3/test_project.py | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/openstackclient/tests/unit/identity/v3/test_project.py b/openstackclient/tests/unit/identity/v3/test_project.py index 2b898090..b99eaf85 100644 --- a/openstackclient/tests/unit/identity/v3/test_project.py +++ b/openstackclient/tests/unit/identity/v3/test_project.py @@ -14,6 +14,7 @@ # import mock +from mock import call from osc_lib import exceptions from osc_lib import utils @@ -763,8 +764,6 @@ class TestProjectShow(TestProject): def test_project_show(self): - self.projects_mock.get.side_effect = [Exception("Not found"), - self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -790,11 +789,7 @@ class TestProjectShow(TestProject): # data to be shown. columns, data = self.cmd.take_action(parsed_args) - self.projects_mock.get.assert_called_with( - self.project.id, - parents_as_list=False, - subtree_as_list=False, - ) + self.projects_mock.get.assert_called_once_with(self.project.id) collist = ( 'description', @@ -824,8 +819,6 @@ class TestProjectShow(TestProject): 'parents': [{'project': {'id': self.project.parent_id}}] } ) - self.projects_mock.get.side_effect = [Exception("Not found"), - self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -849,11 +842,12 @@ class TestProjectShow(TestProject): } columns, data = self.cmd.take_action(parsed_args) - self.projects_mock.get.assert_called_with( - self.project.id, - parents_as_list=True, - subtree_as_list=False, - ) + + self.projects_mock.get.assert_has_calls([call(self.project.id), + call(self.project.id, + parents_as_list=True, + subtree_as_list=False, + )]) collist = ( 'description', @@ -885,8 +879,6 @@ class TestProjectShow(TestProject): 'subtree': [{'project': {'id': 'children-id'}}] } ) - self.projects_mock.get.side_effect = [Exception("Not found"), - self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -910,11 +902,11 @@ class TestProjectShow(TestProject): } columns, data = self.cmd.take_action(parsed_args) - self.projects_mock.get.assert_called_with( - self.project.id, - parents_as_list=False, - subtree_as_list=True, - ) + self.projects_mock.get.assert_has_calls([call(self.project.id), + call(self.project.id, + parents_as_list=False, + subtree_as_list=True, + )]) collist = ( 'description', @@ -947,8 +939,6 @@ class TestProjectShow(TestProject): 'subtree': [{'project': {'id': 'children-id'}}] } ) - self.projects_mock.get.side_effect = [Exception("Not found"), - self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -973,11 +963,11 @@ class TestProjectShow(TestProject): } columns, data = self.cmd.take_action(parsed_args) - self.projects_mock.get.assert_called_with( - self.project.id, - parents_as_list=True, - subtree_as_list=True, - ) + self.projects_mock.get.assert_has_calls([call(self.project.id), + call(self.project.id, + parents_as_list=True, + subtree_as_list=True, + )]) collist = ( 'description', |
