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
This commit is contained in:
Tang Chen 2016-06-24 12:41:52 +08:00 committed by Kirill Zaitsev
parent b7a5c74400
commit e3a2b68f61
8 changed files with 16 additions and 16 deletions

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from openstackclient.common import utils from osc_lib import utils
from oslo_log import log as logging from oslo_log import log as logging
from muranoclient.i18n import _ from muranoclient.i18n import _

View File

@ -17,7 +17,7 @@ import textwrap
from cliff import lister from cliff import lister
from cliff import show from cliff import show
from muranoclient.openstack.common.apiclient import exceptions 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_log import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ from cliff import lister
from cliff import show from cliff import show
from muranoclient.common import utils as murano_utils from muranoclient.common import utils as murano_utils
from muranoclient.openstack.common.apiclient import exceptions 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_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils

View File

@ -11,7 +11,7 @@
# under the License. # under the License.
import mock import mock
from openstackclient.tests import utils from osc_lib.tests import utils
class TestApplicationCatalog(utils.TestCommand): class TestApplicationCatalog(utils.TestCommand):

View File

@ -41,7 +41,7 @@ class TestListCategories(TestCategory):
# Command to test # Command to test
self.cmd = osc_category.ListCategories(self.app, None) 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): def test_category_list(self, mock_util):
mock_util.return_value = ('xyz123', 'fake1') mock_util.return_value = ('xyz123', 'fake1')
@ -99,7 +99,7 @@ class TestCreateCategory(TestCategory):
# Command to test # Command to test
self.cmd = osc_category.CreateCategory(self.app, None) 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): def test_category_list(self, mock_util):
arglist = ['fake1'] arglist = ['fake1']
verifylist = [('name', 'fake1')] verifylist = [('name', 'fake1')]
@ -129,7 +129,7 @@ class TestDeleteCategory(TestCategory):
# Command to test # Command to test
self.cmd = osc_category.DeleteCategory(self.app, None) 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): def test_category_list(self, mock_util):
arglist = ['abc123', '123abc'] arglist = ['abc123', '123abc']
verifylist = [('id', ['abc123', '123abc'])] verifylist = [('id', ['abc123', '123abc'])]

View File

@ -46,7 +46,7 @@ class TestListEnvironment(TestEnvironment):
# Command to test # Command to test
self.cmd = osc_env.ListEnvironments(self.app, None) 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): def test_environment_list_with_no_options(self, mock_util):
arglist = [] arglist = []
verifylist = [] verifylist = []
@ -70,7 +70,7 @@ class TestListEnvironment(TestEnvironment):
'2015-12-16T17:31:54')] '2015-12-16T17:31:54')]
self.assertEqual(expected_data, data) 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): def test_environment_list_with_options(self, mock_util):
arglist = ['--all-tenants'] arglist = ['--all-tenants']
verifylist = [('all_tenants', True)] verifylist = [('all_tenants', True)]
@ -176,7 +176,7 @@ class TestRenameEnvironment(TestEnvironment):
# Command to test # Command to test
self.cmd = osc_env.RenameEnvironment(self.app, None) 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): def test_environment_rename(self, mock_util):
arglist = ['1234', 'fake-1'] arglist = ['1234', 'fake-1']
verifylist = [('id', '1234'), ('name', 'fake-1')] verifylist = [('id', '1234'), ('name', 'fake-1')]
@ -235,7 +235,7 @@ class TestEnvironmentCreate(TestEnvironment):
# Command to test # Command to test
self.cmd = osc_env.EnvironmentCreate(self.app, None) 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): def test_environment_create_with_no_option(self, mock_util):
arglist = ['fake'] arglist = ['fake']
verifylist = [('name', 'fake')] verifylist = [('name', 'fake')]
@ -256,7 +256,7 @@ class TestEnvironmentCreate(TestEnvironment):
'2015-12-16T17:31:54', '2015-12-16T17:31:54')] '2015-12-16T17:31:54', '2015-12-16T17:31:54')]
self.assertEqual(expected_data, data) 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): def test_environment_create_with_region_option(self, mock_util):
arglist = ['fake', '--region', 'region_one'] arglist = ['fake', '--region', 'region_one']
verifylist = [('name', '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')] '2015-12-16T17:31:54', '2015-12-16T17:31:54')]
self.assertEqual(expected_data, data) 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): def test_environment_create_with_net_option(self, mock_util):
arglist = ['fake', '--join-net-id', 'x1y2z3'] arglist = ['fake', '--join-net-id', 'x1y2z3']
verifylist = [('name', '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')] '2015-12-16T17:31:54', '2015-12-16T17:31:54')]
self.assertEqual(expected_data, data) 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): def test_environment_create_with_subnet_option(self, mock_util):
arglist = ['fake', '--join-subnet-id', 'x1y2z3'] arglist = ['fake', '--join-subnet-id', 'x1y2z3']
verifylist = [('name', 'fake'), ('join_subnet_id', 'x1y2z3')] verifylist = [('name', 'fake'), ('join_subnet_id', 'x1y2z3')]
@ -370,7 +370,7 @@ class TestEnvironmentDelete(TestEnvironment):
# Command to test # Command to test
self.cmd = osc_env.EnvironmentDelete(self.app, None) 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): def test_environment_delete(self, mock_util):
arglist = ['fake1', 'fake2'] arglist = ['fake1', 'fake2']
verifylist = [('id', ['fake1', 'fake2'])] verifylist = [('id', ['fake1', 'fake2'])]

View File

@ -13,6 +13,7 @@ pyOpenSSL>=0.14 # Apache-2.0
requests>=2.10.0 # Apache-2.0 requests>=2.10.0 # Apache-2.0
PyYAML>=3.1.0 # MIT PyYAML>=3.1.0 # MIT
yaql>=1.1.0 # Apache 2.0 License 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.serialization>=1.10.0 # Apache-2.0
oslo.utils>=3.11.0 # Apache-2.0 oslo.utils>=3.11.0 # Apache-2.0

View File

@ -12,7 +12,6 @@ tempest>=11.0.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
python-openstackclient>=2.1.0 # Apache-2.0
# doc build requirements # doc build requirements
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0