Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: Ifd0d1b8aa419e39361e76a4f846cb4eeaf0d46ca Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
0764f5dab1
commit
3df667582c
|
@ -11,9 +11,9 @@
|
|||
# under the License.
|
||||
|
||||
import logging
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_messaging import conffixture as messaging_conffixture
|
||||
from oslo_utils import timeutils
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
Test suites for 'common' code used throughout the OpenStack HTTP API.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from testtools import matchers
|
||||
import webob
|
||||
import webob.exc
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.api import common
|
||||
from karbor.tests import base
|
||||
|
||||
|
|
|
@ -9,14 +9,15 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from mock import mock
|
||||
from unittest import mock
|
||||
|
||||
from webob import exc
|
||||
|
||||
from karbor.api.v1 import copies
|
||||
from karbor import context
|
||||
from karbor import exception
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.api import fakes
|
||||
from webob import exc
|
||||
|
||||
PROVIDER_ID_1 = 'efc6a88b-9096-4bb6-8634-cda182a6e12a'
|
||||
PROVIDER_ID_2 = '3241a88b-9096-4bb6-8634-cda182a6e12a'
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
from karbor.api.v1 import providers
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from mock import mock
|
||||
from unittest import mock
|
||||
|
||||
from webob import exc
|
||||
|
||||
from karbor.api.v1 import services
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from datetime import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from webob import exc
|
||||
|
||||
from karbor.api.v1 import triggers as trigger_api
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.services.protection.clients import eisoo
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from oslo_config import cfg
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from oslo_config import cfg
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from oslo_config import cfg
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import karbor_keystone_plugin as kkp
|
||||
|
|
|
@ -10,15 +10,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
|
||||
|
||||
from karbor.common import karbor_keystone_plugin
|
||||
from karbor.tests import base
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import karbor_keystone_plugin
|
||||
from karbor.tests import base
|
||||
|
||||
|
||||
class KarborKeystonePluginTest(base.TestCase):
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
"""The notification module."""
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from karbor.common import notification
|
||||
from karbor.common.notification import EndNotification
|
||||
|
@ -86,7 +86,7 @@ class TestKarborNotification(base.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
super(TestKarborNotification, self).setUp()
|
||||
self.test_n = KarborTestNotification(Mock(), request=Mock())
|
||||
self.test_n = KarborTestNotification(mock.Mock(), request=mock.Mock())
|
||||
|
||||
def test_missing_required_start_traits(self):
|
||||
self.assertRaisesRegex(exception.InvalidInput,
|
||||
|
@ -164,10 +164,10 @@ class TestKarborNotification(base.TestCase):
|
|||
|
||||
def _test_notify_callback(self, fn, *args, **kwargs):
|
||||
with patch.object(rpc, 'get_notifier') as notifier:
|
||||
mock_callback = Mock()
|
||||
mock_callback = mock.Mock()
|
||||
self.test_n.register_notify_callback(mock_callback)
|
||||
mock_context = Mock()
|
||||
mock_context.notification = Mock()
|
||||
mock_context = mock.Mock()
|
||||
mock_context.notification = mock.Mock()
|
||||
self.test_n.context = mock_context
|
||||
fn(*args, **kwargs)
|
||||
self.assertTrue(notifier().info.called)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from iso8601 import iso8601
|
||||
from oslo_utils import uuidutils
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from karbor import objects
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import objects
|
||||
from karbor.tests.unit import fake_operation_log
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import objects
|
||||
from karbor.tests.unit import fake_restore
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from karbor import exception
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from karbor import context
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import objects
|
||||
from karbor.tests.unit import fake_service
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import objects
|
||||
from karbor.tests.unit import fake_verification
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from stevedore import extension as import_driver
|
||||
|
||||
from karbor import exception
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import eventlet
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor import exception
|
||||
|
|
|
@ -16,7 +16,8 @@ from datetime import timedelta
|
|||
import eventlet
|
||||
import functools
|
||||
import heapq
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor import context
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor import context
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
||||
|
||||
from karbor.common import constants
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import exception
|
||||
from karbor.services.operationengine import operation_manager
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor import context
|
||||
from karbor.services.operationengine import user_trust_manager
|
||||
|
|
|
@ -11,18 +11,18 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from troveclient.v1 import instances
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
# Need to register trove_client
|
||||
from karbor.services.protection.clients import trove # noqa
|
||||
from karbor.services.protection.protectable_plugins.database \
|
||||
import DatabaseInstanceProtectablePlugin
|
||||
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from troveclient.v1 import instances
|
||||
|
||||
|
||||
class DatabaseInstanceProtectablePluginTest(base.TestCase):
|
||||
|
|
|
@ -11,17 +11,19 @@
|
|||
# under the License.
|
||||
|
||||
from collections import namedtuple
|
||||
from unittest import mock
|
||||
|
||||
from glanceclient.v2 import images
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from novaclient.v2 import servers
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor import resource
|
||||
from karbor.services.protection.protectable_plugins.image import \
|
||||
ImageProtectablePlugin
|
||||
from karbor.tests import base
|
||||
from keystoneauth1 import session as keystone_session
|
||||
import mock
|
||||
from novaclient.v2 import servers
|
||||
from oslo_config import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -11,7 +11,11 @@
|
|||
# under the License.
|
||||
|
||||
from collections import namedtuple
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from neutronclient.v2_0 import client
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
|
@ -19,9 +23,6 @@ from karbor import resource
|
|||
from karbor.services.protection.protectable_plugins.network import \
|
||||
NetworkProtectablePlugin
|
||||
from karbor.tests import base
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from neutronclient.v2_0 import client
|
||||
from oslo_config import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -10,22 +10,21 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection.clients import k8s # noqa
|
||||
from karbor.services.protection.protectable_plugins.pod \
|
||||
import K8sPodProtectablePlugin
|
||||
from unittest import mock
|
||||
import uuid
|
||||
|
||||
from kubernetes.client.models.v1_object_meta import V1ObjectMeta
|
||||
from kubernetes.client.models.v1_pod import V1Pod
|
||||
from kubernetes.client.models.v1_pod_list import V1PodList
|
||||
from kubernetes.client.models.v1_pod_status import V1PodStatus
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection.clients import k8s # noqa
|
||||
from karbor.services.protection.protectable_plugins.pod \
|
||||
import K8sPodProtectablePlugin
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
import uuid
|
||||
|
||||
|
||||
class PodProtectablePluginTest(base.TestCase):
|
||||
|
|
|
@ -11,16 +11,17 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from novaclient.v2 import servers
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection.protectable_plugins.server \
|
||||
import ServerProtectablePlugin
|
||||
|
||||
from karbor.tests import base
|
||||
from keystoneauth1 import session as keystone_session
|
||||
import mock
|
||||
from novaclient.v2 import servers
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
class ServerProtectablePluginTest(base.TestCase):
|
||||
|
|
|
@ -11,16 +11,16 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from manilaclient.v2 import shares
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection.protectable_plugins.share \
|
||||
import ShareProtectablePlugin
|
||||
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
|
||||
from manilaclient.v2 import shares
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
class ShareProtectablePluginTest(base.TestCase):
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient.v3 import volumes
|
||||
from collections import namedtuple
|
||||
import mock
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
|
|
|
@ -13,11 +13,15 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import futurist
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import futurist
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import graph_flow
|
||||
from taskflow.patterns import linear_flow
|
||||
from taskflow import task
|
||||
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection.bank_plugin import Bank
|
||||
|
@ -28,11 +32,6 @@ from karbor.services.protection import protection_plugin
|
|||
from karbor.services.protection import provider
|
||||
from karbor.services.protection import resource_flow
|
||||
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import graph_flow
|
||||
from taskflow.patterns import linear_flow
|
||||
from taskflow import task
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
A = Resource(id='A', type='fake', name='fake')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
|
@ -23,11 +27,7 @@ from karbor.services.protection.protection_plugins.volume import \
|
|||
volume_freezer_plugin_schemas
|
||||
from karbor.services.protection.protection_plugins.volume.\
|
||||
volume_freezer_plugin import FreezerProtectionPlugin
|
||||
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor import exception
|
||||
|
@ -24,9 +29,6 @@ from karbor.services.protection.protection_plugins.volume.\
|
|||
from karbor.services.protection.protection_plugins.volume import \
|
||||
volume_glance_plugin_schemas
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -10,8 +10,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient import exceptions as cinder_exc
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient import exceptions as cinder_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor import exception
|
||||
|
@ -24,9 +29,6 @@ from karbor.services.protection.protection_plugins.volume \
|
|||
import volume_plugin_cinder_schemas as cinder_schemas
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.protection import fakes
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
ResourceNode = collections.namedtuple(
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -23,9 +28,6 @@ from karbor.services.protection.protection_plugins. \
|
|||
from karbor.services.protection.protection_plugins.volume \
|
||||
import volume_snapshot_plugin_schemas
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from karbor.services.protection.client_factory import ClientFactory
|
||||
from karbor.tests import base
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -18,16 +23,11 @@ from karbor.services.protection.bank_plugin import Bank
|
|||
from karbor.services.protection.bank_plugin import BankPlugin
|
||||
from karbor.services.protection.bank_plugin import BankSection
|
||||
from karbor.services.protection import client_factory
|
||||
|
||||
from karbor.services.protection.protection_plugins. \
|
||||
database.database_backup_plugin import DatabaseBackupProtectionPlugin
|
||||
from karbor.services.protection.protection_plugins.database \
|
||||
import database_backup_plugin_schemas
|
||||
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import session as keystone_session
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -23,10 +29,6 @@ from karbor.services.protection.protection_plugins. \
|
|||
from karbor.services.protection.protection_plugins.image \
|
||||
import image_plugin_schemas
|
||||
from karbor.tests import base
|
||||
from keystoneauth1 import session as keystone_session
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_messaging
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -23,9 +28,6 @@ from karbor.services.protection.protection_plugins. \
|
|||
from karbor.services.protection.protection_plugins.share \
|
||||
import share_snapshot_plugin_schemas
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -23,8 +27,6 @@ from karbor.services.protection.protection_plugins.network \
|
|||
from karbor.services.protection.protection_plugins.network. \
|
||||
neutron_protection_plugin import NeutronProtectionPlugin
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
FakeNetworks = {'networks': [
|
||||
{u'status': u'ACTIVE',
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
from collections import namedtuple
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import constants
|
||||
|
|
|
@ -10,6 +10,15 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from kubernetes.client.models.v1_object_meta import V1ObjectMeta
|
||||
from kubernetes.client.models.v1_pod import V1Pod
|
||||
from kubernetes.client.models.v1_pod_spec import V1PodSpec
|
||||
from kubernetes.client.models.v1_pod_status import V1PodStatus
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.context import RequestContext
|
||||
from karbor.resource import Resource
|
||||
|
@ -18,21 +27,11 @@ from karbor.services.protection.bank_plugin import BankPlugin
|
|||
from karbor.services.protection.bank_plugin import BankSection
|
||||
from karbor.services.protection import client_factory
|
||||
from karbor.services.protection.clients import k8s
|
||||
|
||||
from karbor.services.protection.protection_plugins. \
|
||||
pod.pod_protection_plugin import PodProtectionPlugin
|
||||
from karbor.services.protection.protection_plugins.pod \
|
||||
import pod_plugin_schemas
|
||||
|
||||
from kubernetes.client.models.v1_object_meta import V1ObjectMeta
|
||||
from kubernetes.client.models.v1_pod import V1Pod
|
||||
from kubernetes.client.models.v1_pod_spec import V1PodSpec
|
||||
from kubernetes.client.models.v1_pod_status import V1PodStatus
|
||||
|
||||
from karbor.tests import base
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture
|
||||
|
||||
|
||||
class FakeBankPlugin(BankPlugin):
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.resource import Resource
|
||||
from karbor.services.protection import provider
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.protection import fakes
|
||||
from oslo_config import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
# under the License.
|
||||
|
||||
from functools import partial
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.resource import Resource
|
||||
|
@ -20,7 +22,6 @@ from karbor.services.protection import graph
|
|||
from karbor.services.protection import resource_flow
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.protection import fakes
|
||||
from oslo_config import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -10,14 +10,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import math
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
|
||||
from karbor.services.protection.clients import s3
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.protection.fake_s3_client import FakeS3Client
|
||||
import math
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
import time
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -10,15 +10,17 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import math
|
||||
import os
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
|
||||
from karbor.services.protection.clients import swift
|
||||
from karbor.tests import base
|
||||
from karbor.tests.unit.protection.fake_swift_client import FakeSwiftClient
|
||||
import math
|
||||
import mock
|
||||
import os
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
import time
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
from six.moves import http_client
|
||||
import webob.util
|
||||
|
||||
from karbor import exception
|
||||
from karbor.tests import base
|
||||
|
||||
import mock
|
||||
import six
|
||||
import webob.util
|
||||
|
||||
|
||||
class KarborExceptionTestCase(base.TestCase):
|
||||
def test_default_error_msg(self):
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
Unit Tests for remote procedure calls using queue
|
||||
"""
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
|
|
Loading…
Reference in New Issue