"once_with to test with explicit parameters or an assertEqual with"
" call_count.")
- if 'cinder/tests/' in filename:
+ if 'cinder.functional/tests/' or 'cinder.unit/tests' in filename:
pos = logical_line.find('.assert_called_once(')
if pos != -1:
yield (pos, msg)
from cinder import objects
from cinder import rpc
from cinder import service
-from cinder.tests import conf_fixture
-from cinder.tests import fake_notifier
+from cinder.tests.unit import conf_fixture
+from cinder.tests.unit import fake_notifier
test_opts = [
cfg.StrOpt('sqlite_clean_db',
format=log_format,
level=level))
- rpc.add_extra_exmods("cinder.tests")
+ rpc.add_extra_exmods("cinder.tests.unit")
self.addCleanup(rpc.clear_extra_exmods)
self.addCleanup(rpc.cleanup)
'..',
)
),
- 'cinder/tests/policy.json'))
+ 'cinder/tests/unit/policy.json'))
def _common_cleanup(self):
"""Runs after each test method to tear down test environment."""
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""
-:mod:`cinder.tests` -- Cinder Unittests
-=====================================================
-
-.. automodule:: cinder.tests
- :platform: Unix
-.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
-.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
-.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
-.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
-.. moduleauthor:: Manish Singh <yosh@gimp.org>
-.. moduleauthor:: Andy Smith <andy@anarkystic.com>
-"""
-
-import eventlet
-
-eventlet.monkey_patch()
-
-# See http://code.google.com/p/python-nose/issues/detail?id=373
-# The code below enables nosetests to work with i18n _() blocks
-import __builtin__
-setattr(__builtin__, '_', lambda x: x)
--- /dev/null
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""
+:mod:`cinder.tests.unit` -- Cinder Unittests
+=====================================================
+
+.. automodule:: cinder.tests.unit
+ :platform: Unix
+.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
+.. moduleauthor:: Devin Carlen <devin.carlen@gmail.com>
+.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
+.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
+.. moduleauthor:: Manish Singh <yosh@gimp.org>
+.. moduleauthor:: Andy Smith <andy@anarkystic.com>
+"""
+
+import eventlet
+
+eventlet.monkey_patch()
+
+# See http://code.google.com/p/python-nose/issues/detail?id=373
+# The code below enables nosetests to work with i18n _() blocks
+import __builtin__
+setattr(__builtin__, '_', lambda x: x)
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
-from cinder.tests import cast_as_call
-from cinder.tests import fake_snapshot
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
+from cinder.tests.unit import cast_as_call
+from cinder.tests.unit import fake_snapshot
from cinder.volume import api as volume_api
from cinder.volume.targets import tgt
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import utils
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import utils
# needed for stubs to work
import cinder.volume
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import utils
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import utils
import cinder.volume
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
-from cinder.tests import utils
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
+from cinder.tests.unit import utils
from cinder.volume import api as volume_api
from cinder.api.contrib import extended_snapshot_attributes
from cinder import context
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
UUID1 = '00000000-0000-0000-0000-000000000001'
from cinder.api import xmlutil
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_notifier
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_notifier
def stub_qos_specs(id):
import cinder
from cinder.api.openstack import wsgi
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
UUID = fakes.FAKE_UUID
from cinder.api.contrib import scheduler_stats
from cinder import context
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
def schedule_rpcapi_get_pools(self, context, filters=None):
from cinder import exception
from cinder import policy
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
fake_services_list = [
from cinder import db
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
class SnapshotActionsTest(test.TestCase):
from cinder.api.contrib import types_extra_specs
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_notifier
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_notifier
import cinder.wsgi
from cinder.api.contrib import types_manage
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_notifier
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_notifier
from cinder.volume import volume_types
from cinder.api.openstack import wsgi
from cinder import quota
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
class FakeRequest(object):
from cinder import exception
from cinder.image import glance
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
from cinder import volume
from cinder.volume import api as volume_api
from cinder.volume import rpcapi as volume_rpcapi
from cinder import context
from cinder import db
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder.volume import volume_types
from cinder import context
from cinder import db
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder import volume
from cinder.api.openstack import wsgi
from cinder import db
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder import volume
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
def app():
from cinder import context
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder import volume
from cinder import context
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import utils as tests_utils
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import utils as tests_utils
CONF = cfg.CONF
from cinder import context
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder import volume
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder import transfer
import cinder.volume
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
def generate_type(type_id, is_public):
from cinder import context
from cinder import db
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_notifier
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_notifier
def return_volume_type_encryption(context, volume_type_id):
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
# This list of fake volumes is used by our tests. Each is configured in a
from cinder.api.openstack import wsgi
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
class RequestTest(test.TestCase):
def setUp(self):
super(ExtensionTestCase, self).setUp()
ext_list = CONF.osapi_volume_extension[:]
- fox = ('cinder.tests.api.extensions.foxinsocks.Foxinsocks')
+ fox = ('cinder.tests.unit.api.extensions.foxinsocks.Foxinsocks')
if fox not in ext_list:
ext_list.append(fox)
self.flags(osapi_volume_extension=ext_list)
from cinder.api.v1 import volumes
from cinder.api import versions
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
LOG = logging.getLogger(__name__)
import cinder.db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
CONF = cfg.CONF
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v1 import stubs
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v1 import stubs
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
from cinder import volume
from cinder.api.views import types as views_types
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder.volume import volume_types
import cinder.db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v1 import stubs
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v1 import stubs
CONF = cfg.CONF
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
-from cinder.tests import fake_notifier
-from cinder.tests.image import fake as fake_image
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
+from cinder.tests.unit import fake_notifier
+from cinder.tests.unit.image import fake as fake_image
from cinder.volume import api as volume_api
import cinder.db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
CONF = cfg.CONF
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
from cinder import volume
from cinder.api.views import types as views_types
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
+from cinder.tests.unit.api import fakes
from cinder.volume import volume_types
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
from cinder.volume import api as volume_api
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.api.v2 import stubs
-from cinder.tests import fake_notifier
-from cinder.tests.image import fake as fake_image
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.api.v2 import stubs
+from cinder.tests.unit import fake_notifier
+from cinder.tests.unit.image import fake as fake_image
from cinder.volume import api as volume_api
CONF = cfg.CONF
from oslo_log import log as logging
from cinder.backup import driver
-from cinder.tests.backup import fake_service
+from cinder.tests.unit.backup import fake_service
LOG = logging.getLogger(__name__)
def set_defaults(conf):
conf.set_default('default_volume_type', def_vol_type)
conf.set_default('volume_driver',
- 'cinder.tests.fake_driver.FakeISCSIDriver')
+ 'cinder.tests.unit.fake_driver.FakeISCSIDriver')
conf.set_default('iscsi_helper', 'fake')
conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake')
conf.set_default('connection', 'sqlite://', group='database')
conf.set_default('sqlite_synchronous', False, group='database')
- conf.set_default('policy_file', 'cinder/tests/policy.json')
+ conf.set_default('policy_file', 'cinder.tests.unit/policy.json')
conf.set_default(
'xiv_ds8k_proxy',
- 'cinder.tests.test_ibm_xiv_ds8k.XIVDS8KFakeProxyDriver')
- conf.set_default('backup_driver', 'cinder.tests.backup.fake_service')
+ 'cinder.tests.unit.test_ibm_xiv_ds8k.XIVDS8KFakeProxyDriver')
+ conf.set_default('backup_driver', 'cinder.tests.unit.backup.fake_service')
conf.set_default('fixed_key', default='0' * 64, group='keymgr')
conf.set_default('scheduler_driver',
'cinder.scheduler.filter_scheduler.FilterScheduler')
conf.set_default('state_path', os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..', '..')))
+ os.path.join(os.path.dirname(__file__), '..', '..', '..')))
conf.set_default('policy_dirs', [])
conf.set_default('auth_strategy', 'noauth')
from cinder import context
from cinder import db
from cinder import test
-from cinder.tests import utils as testutils
+from cinder.tests.unit import utils as testutils
class FinishVolumeMigrationTestCase(test.TestCase):
from cinder import context
from cinder import db
from cinder import test
-from cinder.tests import utils as testutils
+from cinder.tests.unit import utils as testutils
CONF = cfg.CONF
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests import utils
+from cinder.tests.unit import utils
LOG = logging.getLogger(__name__)
from oslo_log import log as logging
from cinder.i18n import _LE
-from cinder.tests.brick import fake_lvm
+from cinder.tests.unit.brick import fake_lvm
from cinder.volume import driver
from cinder.volume.drivers import lvm
from cinder.zonemanager import utils as fczm_utils
import mock
-from cinder.tests import fake_hp_client_exceptions as hpexceptions
+from cinder.tests.unit import fake_hp_client_exceptions as hpexceptions
hp3par = mock.Mock()
hp3par.version = "3.1.2"
import mock
-from cinder.tests import fake_hp_client_exceptions as hpexceptions
+from cinder.tests.unit import fake_hp_client_exceptions as hpexceptions
hplefthand = mock.Mock()
hplefthand.version = "1.0.4"
from cinder import exception
from cinder.image import glance
from cinder import test
-from cinder.tests.glance import stubs as glance_stubs
+from cinder.tests.unit.glance import stubs as glance_stubs
CONF = cfg.CONF
from cinder import service
from cinder import test # For the flags
-from cinder.tests.integrated.api import client
+from cinder.tests.unit.integrated.api import client
LOG = logging.getLogger(__name__)
from oslo_config import cfg
from oslo_log import log as logging
-from cinder.tests.integrated import integrated_helpers
+from cinder.tests.unit.integrated import integrated_helpers
CONF = cfg.CONF
f = super(ExtensionsTest, self)._get_flags()
f['osapi_volume_extension'] = CONF.osapi_volume_extension[:]
f['osapi_volume_extension'].append(
- 'cinder.tests.api.extensions.foxinsocks.Foxinsocks')
+ 'cinder.tests.unit.api.extensions.foxinsocks.Foxinsocks')
return f
def test_get_foxnsocks(self):
from oslo_log import log as logging
-from cinder.tests.integrated import integrated_helpers
+from cinder.tests.unit.integrated import integrated_helpers
LOG = logging.getLogger(__name__)
import testtools
from cinder import service
-from cinder.tests import fake_driver
-from cinder.tests.integrated.api import client
-from cinder.tests.integrated import integrated_helpers
+from cinder.tests.unit import fake_driver
+from cinder.tests.unit.integrated.api import client
+from cinder.tests.unit.integrated import integrated_helpers
LOG = logging.getLogger(__name__)
def _get_flags(self):
f = super(VolumesTest, self)._get_flags()
- f['volume_driver'] = 'cinder.tests.fake_driver.LoggingVolumeDriver'
+ f['volume_driver'] = \
+ 'cinder.tests.unit.fake_driver.LoggingVolumeDriver'
return f
def test_get_volumes_summary(self):
from oslo_log import log as logging
from cinder.api import common
-from cinder.tests.integrated import integrated_helpers
+from cinder.tests.unit.integrated import integrated_helpers
LOG = logging.getLogger(__name__)
"""Implementation of a fake key manager."""
-from cinder.tests.keymgr import mock_key_mgr
+from cinder.tests.unit.keymgr import mock_key_mgr
def fake_api():
from cinder import exception
from cinder.keymgr import barbican
from cinder.keymgr import key as keymgr_key
-from cinder.tests.keymgr import test_key_mgr
+from cinder.tests.unit.keymgr import test_key_mgr
CONF = cfg.CONF
CONF.import_opt('encryption_auth_url', 'cinder.keymgr.key_mgr', group='keymgr')
from cinder import exception
from cinder.keymgr import conf_key_mgr
from cinder.keymgr import key
-from cinder.tests.keymgr import test_key_mgr
+from cinder.tests.unit.keymgr import test_key_mgr
CONF = cfg.CONF
from cinder import context
from cinder import exception
from cinder.keymgr import key as keymgr_key
-from cinder.tests.keymgr import mock_key_mgr
-from cinder.tests.keymgr import test_key_mgr
+from cinder.tests.unit.keymgr import mock_key_mgr
+from cinder.tests.unit.keymgr import test_key_mgr
class MockKeyManagerTestCase(test_key_mgr.KeyManagerTestCase):
"""
from cinder.keymgr import not_implemented_key_mgr
-from cinder.tests.keymgr import test_key_mgr
+from cinder.tests.unit.keymgr import test_key_mgr
class NotImplementedKeyManagerTestCase(test_key_mgr.KeyManagerTestCase):
from cinder.objects import base
from cinder.objects import fields
from cinder import test
-from cinder.tests import fake_notifier
+from cinder.tests.unit import fake_notifier
class MyOwnedObject(base.CinderPersistentObject, base.CinderObject):
from cinder.objects import snapshot as snapshot_obj
from cinder.objects import volume as volume_obj
-from cinder.tests import fake_volume
-from cinder.tests.objects import test_objects
+from cinder.tests.unit import fake_volume
+from cinder.tests.unit.objects import test_objects
fake_snapshot = {
'id': '1',
import mock
from cinder import objects
-from cinder.tests import fake_volume
-from cinder.tests.objects import test_objects
+from cinder.tests.unit import fake_volume
+from cinder.tests.unit.objects import test_objects
class TestVolume(test_objects._LocalTest):
from cinder.openstack.common.scheduler import weights
from cinder.scheduler.weights import capacity
from cinder import test
-from cinder.tests.scheduler import fakes
+from cinder.tests.unit.scheduler import fakes
from cinder.volume import utils
CONF = cfg.CONF
from cinder.openstack.common.scheduler import weights
from cinder.scheduler.weights import capacity
from cinder import test
-from cinder.tests.scheduler import fakes
+from cinder.tests.unit.scheduler import fakes
from cinder.volume import utils
CONF = cfg.CONF
from cinder import exception
from cinder.scheduler import filter_scheduler
from cinder.scheduler import host_manager
-from cinder.tests.scheduler import fakes
-from cinder.tests.scheduler import test_scheduler
+from cinder.tests.unit.scheduler import fakes
+from cinder.tests.unit.scheduler import test_scheduler
from cinder.volume import utils
from cinder.scheduler.weights import goodness
from cinder import test
-from cinder.tests.scheduler import fakes
+from cinder.tests.unit.scheduler import fakes
class GoodnessWeigherTestCase(test.TestCase):
from cinder import exception
from cinder.openstack.common.scheduler import filters
from cinder import test
-from cinder.tests.scheduler import fakes
-from cinder.tests import utils
+from cinder.tests.unit.scheduler import fakes
+from cinder.tests.unit import utils
class HostFiltersTestCase(test.TestCase):
from cinder.openstack.common.scheduler import weights
from cinder.scheduler.weights import volume_number
from cinder import test
-from cinder.tests.scheduler import fakes
+from cinder.tests.unit.scheduler import fakes
from cinder.volume import utils
CONF = cfg.CONF
import mock
-from cinder.tests.targets import test_lio_driver as test_lio
-from cinder.tests.targets import test_tgt_driver as test_tgt
+from cinder.tests.unit.targets import test_lio_driver as test_lio
+from cinder.tests.unit.targets import test_tgt_driver as test_tgt
from cinder import utils
from cinder.volume.targets import iser
from cinder.volume.targets import lio
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.backup import fake_service_with_verify as fake_service
+from cinder.tests.unit.backup import fake_service_with_verify as fake_service
CONF = cfg.CONF
backup_id = self._create_backup_db_entry(status='restoring',
volume_id=vol_id)
- service = 'cinder.tests.backup.bad_service'
+ service = 'cinder.tests.unit.backup.bad_service'
db.backup_update(self.ctxt, backup_id, {'service': service})
self.assertRaises(exception.InvalidBackup,
self.backup_mgr.restore_backup,
vol_id = self._create_volume_db_entry(size=1)
backup_id = self._create_backup_db_entry(status='deleting',
volume_id=vol_id)
- service = 'cinder.tests.backup.bad_service'
+ service = 'cinder.tests.unit.backup.bad_service'
db.backup_update(self.ctxt, backup_id, {'service': service})
self.assertRaises(exception.InvalidBackup,
self.backup_mgr.delete_backup,
vol_id = self._create_volume_db_entry(size=1)
backup_id = self._create_backup_db_entry(status='available',
volume_id=vol_id)
- service = 'cinder.tests.backup.bad_service'
+ service = 'cinder.tests.unit.backup.bad_service'
db.backup_update(self.ctxt, backup_id, {'service': service})
self.assertRaises(exception.InvalidBackup,
self.backup_mgr.export_record,
record with a different service to that used to create the backup.
"""
export = self._create_exported_record_entry()
- export['backup_service'] = 'cinder.tests.backup.bad_service'
+ export['backup_service'] = 'cinder.tests.unit.backup.bad_service'
imported_record = self._create_export_record_db_entry()
# Test the case where the additional hosts list is empty
"""Test Case for backups."""
def setUp(self):
- self.override_config("backup_driver",
- "cinder.tests.backup.fake_service_with_verify")
+ self.override_config(
+ "backup_driver",
+ "cinder.tests.unit.backup.fake_service_with_verify")
super(BackupTestCaseWithVerify, self).setUp()
def test_import_record_with_verify(self):
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests.backup import fake_service
+from cinder.tests.unit.backup import fake_service
_backup_db_fields = ['id', 'user_id', 'project_id',
'volume_id', 'host', 'availability_zone',
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests.backup import fake_swift_client
-from cinder.tests.backup import fake_swift_client2
+from cinder.tests.unit.backup import fake_swift_client
+from cinder.tests.unit.backup import fake_swift_client2
LOG = logging.getLogger(__name__)
def test_declare(self):
self.assertNotIn('answer', CONF)
- CONF.import_opt('answer', 'cinder.tests.declare_conf')
+ CONF.import_opt('answer', 'cinder.tests.unit.declare_conf')
self.assertIn('answer', CONF)
self.assertEqual(CONF.answer, 42)
# Make sure we don't overwrite anything
CONF.set_override('answer', 256)
self.assertEqual(CONF.answer, 256)
- CONF.import_opt('answer', 'cinder.tests.declare_conf')
+ CONF.import_opt('answer', 'cinder.tests.unit.declare_conf')
self.assertEqual(CONF.answer, 256)
def test_runtime_and_unknown_conf(self):
self.assertNotIn('runtime_answer', CONF)
- import cinder.tests.runtime_conf # noqa
+ import cinder.tests.unit.runtime_conf # noqa
self.assertIn('runtime_answer', CONF)
self.assertEqual(CONF.runtime_answer, 54)
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests import fake_snapshot
-from cinder.tests import fake_volume
+from cinder.tests.unit import fake_snapshot
+from cinder.tests.unit import fake_volume
from cinder.volume.flows.api import create_volume
from cinder.volume.flows.manager import create_volume as create_volume_manager
from cinder import exception
from cinder import test
-from cinder.tests import utils
+from cinder.tests.unit import utils
from cinder.volume import configuration as conf
from cinder.volume.drivers.emc import emc_cli_fc
from cinder.volume.drivers.emc import emc_cli_iscsi
def test_check_explicit_underscore_import(self):
self.assertEqual(1, len(list(checks.check_explicit_underscore_import(
"LOG.info(_('My info message'))",
- "cinder/tests/other_files.py"))))
+ "cinder.tests.unit/other_files.py"))))
self.assertEqual(1, len(list(checks.check_explicit_underscore_import(
"msg = _('My message')",
- "cinder/tests/other_files.py"))))
+ "cinder.tests.unit/other_files.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"from cinder.i18n import _",
- "cinder/tests/other_files.py"))))
+ "cinder.tests.unit/other_files.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"LOG.info(_('My info message'))",
- "cinder/tests/other_files.py"))))
+ "cinder.tests.unit/other_files.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"msg = _('My message')",
- "cinder/tests/other_files.py"))))
+ "cinder.tests.unit/other_files.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"from cinder.i18n import _, _LW",
- "cinder/tests/other_files2.py"))))
+ "cinder.tests.unit/other_files2.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"msg = _('My message')",
- "cinder/tests/other_files2.py"))))
+ "cinder.tests.unit/other_files2.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"_ = translations.ugettext",
- "cinder/tests/other_files3.py"))))
+ "cinder.tests.unit/other_files3.py"))))
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"msg = _('My message')",
- "cinder/tests/other_files3.py"))))
+ "cinder.tests.unit/other_files3.py"))))
# Complete code coverage by falling through all checks
self.assertEqual(0, len(list(checks.check_explicit_underscore_import(
"LOG.info('My info message')",
- "cinder/tests/other_files4.py"))))
+ "cinder.tests.unit/other_files4.py"))))
def test_check_no_log_audit(self):
self.assertEqual(1, len(list(checks.check_no_log_audit(
def test_check_assert_called_once(self):
self.assertEqual(0, len(list(checks.check_assert_called_once(
- ".assert_called_with(", "cinder/tests/test1.py"))))
+ ".assert_called_with(", "cinder.tests.unit/test1.py"))))
self.assertEqual(0, len(list(checks.check_assert_called_once(
".assert_called_with(", "cinder/blah.py"))))
self.assertEqual(1, len(list(checks.check_assert_called_once(
- ".assert_called_once(", "cinder/tests/test1.py"))))
+ ".assert_called_once(", "cinder.tests.unit/test1.py"))))
self.assertEqual(0, len(list(checks.check_assert_called_once(
- ".assertEqual(", "cinder/tests/test1.py"))))
+ ".assertEqual(", "cinder.tests.unit/test1.py"))))
def test_oslo_namespace_imports_check(self):
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"cinder/cmd/file.py", False))))
self.assertEqual(0, len(list(checks.check_no_print_statements(
"print('My print statement that I just must have.')",
- "cinder/tests/file.py", True))))
+ "cinder.tests.unit/file.py", True))))
self.assertEqual(1, len(list(checks.check_no_print_statements(
"print ('My print with space')",
"cinder/volume/anotherFile.py", False))))
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests import fake_hp_3par_client as hp3parclient
+from cinder.tests.unit import fake_hp_3par_client as hp3parclient
from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon
from cinder.volume.drivers.san.hp import hp_3par_fc as hpfcdriver
from cinder.volume.drivers.san.hp import hp_3par_iscsi as hpdriver
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests import fake_hp_lefthand_client as hplefthandclient
+from cinder.tests.unit import fake_hp_lefthand_client as hplefthandclient
from cinder.volume.drivers.san.hp import hp_lefthand_iscsi
from cinder.volume.drivers.san.hp import hp_lefthand_rest_proxy
from cinder.volume import volume_types
configuration = mox.MockObject(conf.Configuration)
configuration.san_is_local = False
configuration.xiv_ds8k_proxy = \
- 'cinder.tests.test_ibm_xiv_ds8k.XIVDS8KFakeProxyDriver'
+ 'cinder.tests.unit.test_ibm_xiv_ds8k.XIVDS8KFakeProxyDriver'
configuration.xiv_ds8k_connection_type = 'iscsi'
configuration.xiv_chap = 'disabled'
configuration.san_ip = FAKE
from cinder import exception
from cinder import quota
from cinder import test
-import cinder.tests.image.fake
+import cinder.tests.unit.image.fake
from cinder import volume
# conflicts with the test cases here that are setting up their own
# defaults.
db.quota_class_destroy_all_by_name(self.context, 'default')
- self.addCleanup(cinder.tests.image.fake.FakeImageService_reset)
+ self.addCleanup(cinder.tests.unit.image.fake.FakeImageService_reset)
def _create_volume(self, size=1):
"""Create a test volume."""
def test_init_override_string(self):
quota_obj = quota.QuotaEngine(
- quota_driver_class='cinder.tests.test_quota.FakeDriver')
+ quota_driver_class='cinder.tests.unit.test_quota.FakeDriver')
self.assertEqual(quota_obj.resources, {})
self.assertIsInstance(quota_obj._driver, FakeDriver)
from cinder.i18n import _
from cinder.image import image_utils
from cinder import test
-from cinder.tests.image import fake as fake_image
-from cinder.tests import test_volume
+from cinder.tests.unit.image import fake as fake_image
+from cinder.tests.unit import test_volume
from cinder.volume import configuration as conf
import cinder.volume.drivers.rbd as driver
from cinder.volume.flows.manager import create_volume
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests import utils as test_utils
+from cinder.tests.unit import utils as test_utils
from cinder.volume import driver
test_service_opts = [
cfg.StrOpt("fake_manager",
- default="cinder.tests.test_service.FakeManager",
+ default="cinder.tests.unit.test_service.FakeManager",
help="Manager for testing"),
cfg.StrOpt("test_service_listen",
default=None,
serv = service.Service('test',
'test',
'test',
- 'cinder.tests.test_service.FakeManager')
+ 'cinder.tests.unit.test_service.FakeManager')
serv.start()
self.assertEqual('manager', serv.test_method())
serv = ExtendedService('test',
'test',
'test',
- 'cinder.tests.test_service.FakeManager')
+ 'cinder.tests.unit.test_service.FakeManager')
serv.start()
self.assertEqual('service', serv.test_method())
serv = service.Service(host,
binary,
topic,
- 'cinder.tests.test_service.FakeManager')
+ 'cinder.tests.unit.test_service.FakeManager')
serv.start()
serv.report_state()
self.assertTrue(serv.model_disconnected)
serv = service.Service(host,
binary,
topic,
- 'cinder.tests.test_service.FakeManager')
+ 'cinder.tests.unit.test_service.FakeManager')
serv.start()
serv.model_disconnected = True
serv.report_state()
def test_service_with_long_report_interval(self):
self.override_config('service_down_time', 10)
self.override_config('report_interval', 10)
- service.Service.create(binary="test_service",
- manager="cinder.tests.test_service.FakeManager")
+ service.Service.create(
+ binary="test_service",
+ manager="cinder.tests.unit.test_service.FakeManager")
self.assertEqual(25, CONF.service_down_time)
from cinder import context
from cinder import exception
from cinder import test
-from cinder.tests.brick import test_brick_lvm
+from cinder.tests.unit.brick import test_brick_lvm
from cinder.volume import configuration as conf
from cinder.volume.drivers import srb
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests import utils as testutils
+from cinder.tests.unit import utils as testutils
from cinder import utils
from cinder.volume import configuration as conf
from cinder.volume.drivers.ibm import storwize_svc
# under the License.
from cinder import test
-from cinder.tests import utils as test_utils
+from cinder.tests.unit import utils as test_utils
class TestUtilsTestCase(test.TestCase):
"""Unit test for utils.monkey_patch()."""
def setUp(self):
super(MonkeyPatchTestCase, self).setUp()
- self.example_package = 'cinder.tests.monkey_patch_example.'
+ self.example_package = 'cinder.tests.unit.monkey_patch_example.'
self.flags(
monkey_patch=True,
monkey_patch_modules=[self.example_package + 'example_a' + ':'
def test_monkey_patch(self):
utils.monkey_patch()
- cinder.tests.monkey_patch_example.CALLED_FUNCTION = []
- from cinder.tests.monkey_patch_example import example_a
- from cinder.tests.monkey_patch_example import example_b
+ cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION = []
+ from cinder.tests.unit.monkey_patch_example import example_a
+ from cinder.tests.unit.monkey_patch_example import example_b
self.assertEqual('Example function', example_a.example_function_a())
exampleA = example_a.ExampleClassA()
self.assertEqual(ret_b, 8)
package_a = self.example_package + 'example_a.'
- self.assertTrue(package_a + 'example_function_a'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
-
- self.assertTrue(package_a + 'ExampleClassA.example_method'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
- self.assertTrue(package_a + 'ExampleClassA.example_method_add'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
+ self.assertTrue(
+ package_a + 'example_function_a'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
+
+ self.assertTrue(
+ package_a + 'ExampleClassA.example_method'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
+ self.assertTrue(
+ package_a + 'ExampleClassA.example_method_add'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
package_b = self.example_package + 'example_b.'
- self.assertFalse(package_b + 'example_function_b'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
- self.assertFalse(package_b + 'ExampleClassB.example_method'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
- self.assertFalse(package_b + 'ExampleClassB.example_method_add'
- in cinder.tests.monkey_patch_example.CALLED_FUNCTION)
+ self.assertFalse(
+ package_b + 'example_function_b'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
+ self.assertFalse(
+ package_b + 'ExampleClassB.example_method'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
+ self.assertFalse(
+ package_b + 'ExampleClassB.example_method_add'
+ in cinder.tests.unit.monkey_patch_example.CALLED_FUNCTION)
class AuditPeriodTest(test.TestCase):
from cinder import exception
from cinder import test
-from cinder.tests import fake_vmem_client as vmemclient
+from cinder.tests.unit import fake_vmem_client as vmemclient
from cinder.volume import configuration as conf
from cinder.volume.drivers.violin import v6000_common
from cinder.db.sqlalchemy import models
from cinder import exception
from cinder import test
-from cinder.tests import fake_vmem_client as vmemclient
+from cinder.tests.unit import fake_vmem_client as vmemclient
from cinder.volume import configuration as conf
from cinder.volume.drivers.violin import v6000_common
from cinder.volume.drivers.violin import v6000_fcp
from cinder.db.sqlalchemy import models
from cinder import exception
from cinder import test
-from cinder.tests import fake_vmem_client as vmemclient
+from cinder.tests.unit import fake_vmem_client as vmemclient
from cinder.volume import configuration as conf
from cinder.volume.drivers.violin import v6000_common
from cinder.volume.drivers.violin import v6000_iscsi
import cinder.policy
from cinder import quota
from cinder import test
-from cinder.tests.api import fakes
-from cinder.tests.brick import fake_lvm
-from cinder.tests import conf_fixture
-from cinder.tests import fake_driver
-from cinder.tests import fake_notifier
-from cinder.tests.image import fake as fake_image
-from cinder.tests.keymgr import fake as fake_keymgr
-from cinder.tests import utils as tests_utils
+from cinder.tests.unit.api import fakes
+from cinder.tests.unit.brick import fake_lvm
+from cinder.tests.unit import conf_fixture
+from cinder.tests.unit import fake_driver
+from cinder.tests.unit import fake_notifier
+from cinder.tests.unit.image import fake as fake_image
+from cinder.tests.unit.keymgr import fake as fake_keymgr
+from cinder.tests.unit import utils as tests_utils
from cinder import utils
import cinder.volume
from cinder.volume import configuration as conf
with mock.patch.object(cinder.volume.volume_types,
'get_volume_type_qos_specs') as type_qos, \
- mock.patch.object(cinder.tests.fake_driver.FakeISCSIDriver,
+ mock.patch.object(cinder.tests.unit.fake_driver.FakeISCSIDriver,
'initialize_connection') as driver_init:
type_qos.return_value = dict(qos_specs=qos_values)
driver_init.return_value = {'data': {}}
class GenericVolumeDriverTestCase(DriverTestCase):
"""Test case for VolumeDriver."""
- driver_name = "cinder.tests.fake_driver.LoggingVolumeDriver"
+ driver_name = "cinder.tests.unit.fake_driver.LoggingVolumeDriver"
def test_backup_volume(self):
vol = tests_utils.create_volume(self.context)
from cinder import db
from cinder import objects
from cinder import test
-from cinder.tests import fake_snapshot
+from cinder.tests.unit import fake_snapshot
from cinder.volume import rpcapi as volume_rpcapi
from cinder import db
from cinder import exception
from cinder import test
-from cinder.tests import utils
+from cinder.tests.unit import utils
from cinder.transfer import api as transfer_api
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests import conf_fixture
+from cinder.tests.unit import conf_fixture
from cinder.volume import qos_specs
from cinder.volume import volume_types
import six
from cinder import test
-from cinder.tests.volume.drivers.netapp.dataontap import fakes as fake
+from cinder.tests.unit.volume.drivers.netapp.dataontap import fakes as fake
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.client import client_7mode
from cinder.volume.drivers.netapp import utils as netapp_utils
import six
from cinder import test
-import cinder.tests.volume.drivers.netapp.dataontap.fakes as fake
+import cinder.tests.unit.volume.drivers.netapp.dataontap.fakes as fake
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.client import client_base
from cinder import exception
from cinder import test
-from cinder.tests.volume.drivers.netapp.dataontap.client import fakes as fake
-from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
+from cinder.tests.unit.volume.drivers.netapp.dataontap.client import (
+ fakes as fake)
+from cinder.volume.drivers.netapp.dataontap.client import (
+ api as netapp_api)
from cinder.volume.drivers.netapp.dataontap.client import client_cmode
from cinder.volume.drivers.netapp import utils as netapp_utils
from cinder import exception
from cinder import test
-import cinder.tests.volume.drivers.netapp.dataontap.fakes as fake
-import cinder.tests.volume.drivers.netapp.fakes as na_fakes
+import cinder.tests.unit.volume.drivers.netapp.dataontap.fakes as fake
+import cinder.tests.unit.volume.drivers.netapp.fakes as na_fakes
from cinder.volume.drivers.netapp.dataontap import block_7mode
from cinder.volume.drivers.netapp.dataontap import block_base
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder import exception
from cinder.i18n import _
from cinder import test
-from cinder.tests.volume.drivers.netapp.dataontap import fakes as fake
+from cinder.tests.unit.volume.drivers.netapp.dataontap import fakes as fake
from cinder.volume.drivers.netapp.dataontap import block_base
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp import utils as na_utils
from cinder import exception
from cinder import test
-import cinder.tests.volume.drivers.netapp.dataontap.fakes as fake
-import cinder.tests.volume.drivers.netapp.fakes as na_fakes
+import cinder.tests.unit.volume.drivers.netapp.dataontap.fakes as fake
+import cinder.tests.unit.volume.drivers.netapp.fakes as na_fakes
from cinder.volume.drivers.netapp.dataontap import block_base
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.brick.remotefs import remotefs as remotefs_brick
from cinder import test
-from cinder.tests.volume.drivers.netapp import fakes as na_fakes
+from cinder.tests.unit.volume.drivers.netapp import fakes as na_fakes
from cinder import utils
from cinder.volume.drivers.netapp.dataontap.client import client_cmode
from cinder.volume.drivers.netapp.dataontap import nfs_cmode
import mock
from cinder import test
-from cinder.tests.volume.drivers.netapp import fakes as na_fakes
+from cinder.tests.unit.volume.drivers.netapp import fakes as na_fakes
from cinder.volume.drivers.netapp.eseries import client as es_client
from cinder.volume.drivers.netapp.eseries import iscsi as es_iscsi
from cinder.volume.drivers.netapp import utils as na_utils
from cinder import exception
from cinder import test
-import cinder.tests.volume.drivers.netapp.fakes as na_fakes
+import cinder.tests.unit.volume.drivers.netapp.fakes as na_fakes
import cinder.volume.drivers.netapp.common as na_common
import cinder.volume.drivers.netapp.dataontap.fc_cmode as fc_cmode
import cinder.volume.drivers.netapp.utils as na_utils
from cinder import exception
from cinder import test
-import cinder.tests.volume.drivers.netapp.fakes as fake
+import cinder.tests.unit.volume.drivers.netapp.fakes as fake
from cinder import version
import cinder.volume.drivers.netapp.utils as na_utils
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder import test
-from cinder.tests.windows import db_fakes
+from cinder.tests.unit.windows import db_fakes
from cinder.volume import configuration as conf
from cinder.volume.drivers.windows import constants
from cinder.volume.drivers.windows import vhdutils
configuration = conf.Configuration(fc_test_opts)
# fill up config
configuration.zoning_mode = 'fabric'
- configuration.zone_driver = ('cinder.tests.zonemanager.'
+ configuration.zone_driver = ('cinder.tests.unit.zonemanager.'
'test_brcd_fc_zone_driver.'
'FakeBrcdFCZoneDriver')
- configuration.brcd_sb_connector = ('cinder.tests.zonemanager.'
+ configuration.brcd_sb_connector = ('cinder.tests.unit.zonemanager.'
'test_brcd_fc_zone_driver'
'.FakeBrcdFCZoneClientCLI')
configuration.zoning_policy = 'initiator-target'
configuration.zone_activate = True
configuration.zone_name_prefix = 'openstack'
- configuration.fc_san_lookup_service = ('cinder.tests.zonemanager.'
+ configuration.fc_san_lookup_service = ('cinder.tests.unit.zonemanager.'
'test_brcd_fc_zone_driver.'
'FakeBrcdFCSanLookupService')
configuration = conf.Configuration(None)
# fill up config
configuration.fc_san_lookup_service = (
- 'cinder.tests.zonemanager.test_brcd_lookup_service.'
+ 'cinder.tests.unit.zonemanager.test_brcd_lookup_service.'
'FakeBrcdFCSanLookupService')
return configuration
configuration = conf.Configuration(fc_test_opts)
# fill up config
configuration.zoning_mode = 'fabric'
- configuration.zone_driver = ('cinder.tests.zonemanager.'
+ configuration.zone_driver = ('cinder.tests.unit.zonemanager.'
'test_cisco_fc_zone_driver.'
'FakeCiscoFCZoneDriver')
- configuration.cisco_sb_connector = ('cinder.tests.zonemanager.'
+ configuration.cisco_sb_connector = ('cinder.tests.unit.zonemanager.'
'test_cisco_fc_zone_driver'
'.FakeCiscoFCZoneClientCLI')
configuration.zoning_policy = 'initiator-target'
configuration.zone_activate = True
configuration.zone_name_prefix = 'openstack'
- configuration.fc_san_lookup_service = ('cinder.tests.zonemanager.'
+ configuration.fc_san_lookup_service = ('cinder.tests.unit.zonemanager.'
'test_cisco_fc_zone_driver.'
'FakeCiscoFCSanLookupService')
def setup_config(self):
configuration = conf.Configuration(None)
# fill up config
- configuration.fc_san_lookup_service = ('cinder.tests.zonemanager'
+ configuration.fc_san_lookup_service = ('cinder.tests.unit.zonemanager'
'.test_cisco_lookup_service'
'.FakeCiscoFCSanLookupService')
return configuration
import mock
from cinder import test
-from cinder.tests import fake_driver
+from cinder.tests.unit import fake_driver
from cinder import utils
from cinder.volume import configuration as conf
from cinder.zonemanager.drivers.brocade import brcd_fc_zone_driver