From e3a2b68f61d898c6a415ded9ba07a5fb6ce946d8 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Fri, 24 Jun 2016 12:41:52 +0800 Subject: [PATCH] Use osc-lib instead of openstackclient osc-lib is a package of common support modules for writing OSC plugins. All common functions, classes such as exceptions, utils, logs and so on have been moved from openstackclient to osc-lib. So use osc-lib instead of openstackclient. Targets: blueprint openstack-client-plugin-support Change-Id: I4b998cea5c901436e3934d77f2d3a227eb5d1d9d --- muranoclient/osc/plugin.py | 2 +- muranoclient/osc/v1/category.py | 2 +- muranoclient/osc/v1/environment.py | 2 +- muranoclient/tests/unit/osc/v1/fakes.py | 2 +- muranoclient/tests/unit/osc/v1/test_category.py | 6 +++--- .../tests/unit/osc/v1/test_environment.py | 16 ++++++++-------- requirements.txt | 1 + test-requirements.txt | 1 - 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/muranoclient/osc/plugin.py b/muranoclient/osc/plugin.py index 31fc4690..530d4263 100644 --- a/muranoclient/osc/plugin.py +++ b/muranoclient/osc/plugin.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from openstackclient.common import utils +from osc_lib import utils from oslo_log import log as logging from muranoclient.i18n import _ diff --git a/muranoclient/osc/v1/category.py b/muranoclient/osc/v1/category.py index 866798a9..8ac6fde6 100644 --- a/muranoclient/osc/v1/category.py +++ b/muranoclient/osc/v1/category.py @@ -17,7 +17,7 @@ import textwrap from cliff import lister from cliff import show from muranoclient.openstack.common.apiclient import exceptions -from openstackclient.common import utils +from osc_lib import utils from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/muranoclient/osc/v1/environment.py b/muranoclient/osc/v1/environment.py index d875081c..168b3b81 100644 --- a/muranoclient/osc/v1/environment.py +++ b/muranoclient/osc/v1/environment.py @@ -18,7 +18,7 @@ from cliff import lister from cliff import show from muranoclient.common import utils as murano_utils from muranoclient.openstack.common.apiclient import exceptions -from openstackclient.common import utils +from osc_lib import utils from oslo_log import log as logging from oslo_serialization import jsonutils diff --git a/muranoclient/tests/unit/osc/v1/fakes.py b/muranoclient/tests/unit/osc/v1/fakes.py index cd3c94b5..359f6918 100644 --- a/muranoclient/tests/unit/osc/v1/fakes.py +++ b/muranoclient/tests/unit/osc/v1/fakes.py @@ -11,7 +11,7 @@ # under the License. import mock -from openstackclient.tests import utils +from osc_lib.tests import utils class TestApplicationCatalog(utils.TestCommand): diff --git a/muranoclient/tests/unit/osc/v1/test_category.py b/muranoclient/tests/unit/osc/v1/test_category.py index 08ac786b..011c4479 100644 --- a/muranoclient/tests/unit/osc/v1/test_category.py +++ b/muranoclient/tests/unit/osc/v1/test_category.py @@ -41,7 +41,7 @@ class TestListCategories(TestCategory): # Command to test self.cmd = osc_category.ListCategories(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_category_list(self, mock_util): mock_util.return_value = ('xyz123', 'fake1') @@ -99,7 +99,7 @@ class TestCreateCategory(TestCategory): # Command to test self.cmd = osc_category.CreateCategory(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_category_list(self, mock_util): arglist = ['fake1'] verifylist = [('name', 'fake1')] @@ -129,7 +129,7 @@ class TestDeleteCategory(TestCategory): # Command to test self.cmd = osc_category.DeleteCategory(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_category_list(self, mock_util): arglist = ['abc123', '123abc'] verifylist = [('id', ['abc123', '123abc'])] diff --git a/muranoclient/tests/unit/osc/v1/test_environment.py b/muranoclient/tests/unit/osc/v1/test_environment.py index a2c9876d..3e163b43 100644 --- a/muranoclient/tests/unit/osc/v1/test_environment.py +++ b/muranoclient/tests/unit/osc/v1/test_environment.py @@ -46,7 +46,7 @@ class TestListEnvironment(TestEnvironment): # Command to test self.cmd = osc_env.ListEnvironments(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_list_with_no_options(self, mock_util): arglist = [] verifylist = [] @@ -70,7 +70,7 @@ class TestListEnvironment(TestEnvironment): '2015-12-16T17:31:54')] self.assertEqual(expected_data, data) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_list_with_options(self, mock_util): arglist = ['--all-tenants'] verifylist = [('all_tenants', True)] @@ -176,7 +176,7 @@ class TestRenameEnvironment(TestEnvironment): # Command to test self.cmd = osc_env.RenameEnvironment(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_rename(self, mock_util): arglist = ['1234', 'fake-1'] verifylist = [('id', '1234'), ('name', 'fake-1')] @@ -235,7 +235,7 @@ class TestEnvironmentCreate(TestEnvironment): # Command to test self.cmd = osc_env.EnvironmentCreate(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_create_with_no_option(self, mock_util): arglist = ['fake'] verifylist = [('name', 'fake')] @@ -256,7 +256,7 @@ class TestEnvironmentCreate(TestEnvironment): '2015-12-16T17:31:54', '2015-12-16T17:31:54')] self.assertEqual(expected_data, data) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_create_with_region_option(self, mock_util): arglist = ['fake', '--region', 'region_one'] verifylist = [('name', 'fake'), ('region', 'region_one')] @@ -281,7 +281,7 @@ class TestEnvironmentCreate(TestEnvironment): '2015-12-16T17:31:54', '2015-12-16T17:31:54')] self.assertEqual(expected_data, data) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_create_with_net_option(self, mock_util): arglist = ['fake', '--join-net-id', 'x1y2z3'] verifylist = [('name', 'fake'), ('join_net_id', 'x1y2z3')] @@ -320,7 +320,7 @@ class TestEnvironmentCreate(TestEnvironment): '2015-12-16T17:31:54', '2015-12-16T17:31:54')] self.assertEqual(expected_data, data) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_create_with_subnet_option(self, mock_util): arglist = ['fake', '--join-subnet-id', 'x1y2z3'] verifylist = [('name', 'fake'), ('join_subnet_id', 'x1y2z3')] @@ -370,7 +370,7 @@ class TestEnvironmentDelete(TestEnvironment): # Command to test self.cmd = osc_env.EnvironmentDelete(self.app, None) - @mock.patch('openstackclient.common.utils.get_item_properties') + @mock.patch('osc_lib.utils.get_item_properties') def test_environment_delete(self, mock_util): arglist = ['fake1', 'fake2'] verifylist = [('id', ['fake1', 'fake2'])] diff --git a/requirements.txt b/requirements.txt index 09ca7554..e114960a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,7 @@ pyOpenSSL>=0.14 # Apache-2.0 requests>=2.10.0 # Apache-2.0 PyYAML>=3.1.0 # MIT yaql>=1.1.0 # Apache 2.0 License +osc-lib>=0.1.0 # Apache-2.0 oslo.serialization>=1.10.0 # Apache-2.0 oslo.utils>=3.11.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index bd711812..7ee66b7f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,7 +12,6 @@ tempest>=11.0.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT -python-openstackclient>=2.1.0 # Apache-2.0 # doc build requirements oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0