Reorganize unit test tree

This change ensures that the structure of the unit test tree matches
that of the code tree to make it obvious where to find tests for a
given module.  A check is added to the pep8 job to protect against
regressions.

The plugin test paths are relocated to neutron/tests/unit/plugins
but are otherwise ignored for now.

Change-Id: If307593259139171be21a71c58e3a34bf148cc7f
Partial-Bug: #1440834
This commit is contained in:
Maru Newby 2015-04-04 00:22:05 +00:00
parent e734726b72
commit 1105782e39
165 changed files with 294 additions and 203 deletions

View File

@ -24,6 +24,39 @@ fixes that are submitted also have tests to prove that they stay
fixed! In addition, before proposing for merge, all of the
current tests should be passing.
Structure of the unit test tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The structure of the unit test tree should match the structure of the
code tree, e.g. ::
- target module: neutron.agent.utils
- test module: neutron.tests.unit.agent.test_utils
Unit test modules should have the same path under neutron/tests/unit/
as the module they target has under neutron/, and their name should be
the name of the target module prefixed by 'test_'. This requirement
is intended to make it easier for developers to find the unit tests
for a given module.
Similarly, when a test module targets a package, that module's name
should be the name of the package prefixed by 'test_' with the same
path as when a test targets a module, e.g. ::
- target package: neutron.ipam
- test module: neutron.tests.unit.test_ipam
The following command can be used to validate whether the unit test
tree is structured according to the above requirements: ::
./tools/check_unit_test_structure.sh
Where appropriate, exceptions can be added to the above script. If
code is not part of the neutron namespace, for example, it's probably
reasonable to exclude their unit tests from the check.
Virtual environments
~~~~~~~~~~~~~~~~~~~~

View File

@ -5,4 +5,4 @@ pipeline = extensions extensions_test_app
paste.filter_factory = neutron.common.extensions:plugin_aware_extension_middleware_factory
[app:extensions_test_app]
paste.app_factory = neutron.tests.unit.test_extensions:app_factory
paste.app_factory = neutron.tests.unit.api.test_extensions:app_factory

View File

@ -29,7 +29,7 @@ import testscenarios
from neutron.tests import base as tests_base
from neutron.tests.retargetable import client_fixtures
from neutron.tests.unit.ml2 import test_ml2_plugin
from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
# Each plugin must add a class to plugin_configurations that can configure the

View File

@ -22,10 +22,10 @@ from webob import exc
from neutron import context
from neutron.extensions import portbindings
from neutron import manager
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
class PortBindingsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
class PortBindingsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
# VIF_TYPE must be overridden according to plugin vif_type
VIF_TYPE = portbindings.VIF_TYPE_OTHER

View File

@ -25,10 +25,10 @@ from neutron.agent.linux import iptables_firewall
from neutron.agent import securitygroups_rpc as sg_cfg
from neutron.common import constants
from neutron.tests import base
from neutron.tests.unit import test_api_v2
from neutron.tests.unit.api.v2 import test_base
_uuid = test_api_v2._uuid
_uuid = test_base._uuid
#TODO(mangelajo): replace all 'IPv4', 'IPv6' to constants
FAKE_PREFIX = {'IPv4': '10.0.0.0/24',
'IPv6': 'fe80::/48'}

View File

@ -36,7 +36,7 @@ from neutron.extensions import allowedaddresspairs as addr_pair
from neutron.extensions import securitygroup as ext_sg
from neutron import manager
from neutron.tests import base
from neutron.tests.unit import test_extension_security_group as test_sg
from neutron.tests.unit.extensions import test_securitygroup as test_sg
FAKE_PREFIX = {const.IPv4: '10.0.0.0/24',
const.IPv6: '2001:db8::/64'}
@ -46,7 +46,7 @@ FAKE_IP = {const.IPv4: '10.0.0.1',
'IPv6_LLA': 'fe80::123',
'IPv6_DHCP': '2001:db8::3'}
TEST_PLUGIN_CLASS = ('neutron.tests.unit.test_security_groups_rpc.'
TEST_PLUGIN_CLASS = ('neutron.tests.unit.agent.test_securitygroups_rpc.'
'SecurityGroupRpcTestPlugin')

View File

@ -35,17 +35,17 @@ from neutron.plugins.common import constants
from neutron.plugins.ml2 import plugin as ml2_plugin
from neutron import quota
from neutron.tests import base
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit import extension_stubs as ext_stubs
import neutron.tests.unit.extensions
from neutron.tests.unit.extensions import extendedattribute as extattr
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import testlib_api
from neutron import wsgi
LOG = logging.getLogger(__name__)
_uuid = test_api_v2._uuid
_get_path = test_api_v2._get_path
_uuid = test_base._uuid
_get_path = test_base._get_path
extensions_path = ':'.join(neutron.tests.unit.extensions.__path__)
@ -721,7 +721,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
def setUp(self):
super(ExtensionExtendedAttributeTestCase, self).setUp()
plugin = (
"neutron.tests.unit.test_extensions."
"neutron.tests.unit.api.test_extensions."
"ExtensionExtendedAttributeTestPlugin"
)

View File

@ -1105,7 +1105,7 @@ class SubresourceTest(base.BaseTestCase):
def setUp(self):
super(SubresourceTest, self).setUp()
plugin = 'neutron.tests.unit.test_api_v2.TestSubresourcePlugin'
plugin = 'neutron.tests.unit.api.v2.test_base.TestSubresourcePlugin'
extensions.PluginAwareExtensionManager._instance = None
# Save the global RESOURCE_ATTRIBUTE_MAP

View File

@ -24,7 +24,7 @@ import neutron.extensions
from neutron.extensions import metering
from neutron.plugins.common import constants
from neutron.services.metering import metering_plugin
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
DB_METERING_PLUGIN_KLASS = (
"neutron.services.metering."
@ -108,8 +108,9 @@ class MeteringPluginDbTestCaseMixin(object):
yield metering_label_rule
class MeteringPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
MeteringPluginDbTestCaseMixin):
class MeteringPluginDbTestCase(
test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
MeteringPluginDbTestCaseMixin):
fmt = 'json'
resource_prefix_map = dict(

View File

@ -22,15 +22,16 @@ from neutron.extensions import allowedaddresspairs as addr_pair
from neutron.extensions import portsecurity as psec
from neutron.extensions import securitygroup as secgroup
from neutron import manager
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
from oslo_config import cfg
DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_allowedaddresspairs.'
DB_PLUGIN_KLASS = ('neutron.tests.unit.db.test_allowedaddresspairs_db.'
'AllowedAddressPairTestPlugin')
class AllowedAddressPairTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
class AllowedAddressPairTestCase(
test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self, plugin=None, ext_mgr=None):
super(AllowedAddressPairTestCase, self).setUp(plugin)

View File

@ -39,7 +39,7 @@ from neutron.db import db_base_plugin_v2
from neutron.db import models_v2
from neutron import manager
from neutron.tests import base
from neutron.tests.unit import test_extensions
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit import testlib_api
DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'

View File

@ -26,8 +26,8 @@ import webtest
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron import quota
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_extensions
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit import testlib_api
@ -117,7 +117,7 @@ class ExtensionTestCase(testlib_api.WebTestCase):
if self._translate_resource_name:
path = path.replace('_', '-')
res = self.api.delete(
test_api_v2._get_path(path, id=entity_id, fmt=self.fmt))
test_base._get_path(path, id=entity_id, fmt=self.fmt))
delete_entity = getattr(self.plugin.return_value, "delete_" + entity)
delete_entity.assert_called_with(mock.ANY, entity_id)
self.assertEqual(res.status_int, exc.HTTPNoContent.code)

View File

@ -29,14 +29,14 @@ from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
from neutron.extensions import agent
from neutron.openstack.common import uuidutils
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.db import test_db_base_plugin_v2
LOG = logging.getLogger(__name__)
_uuid = uuidutils.generate_uuid
_get_path = test_api_v2._get_path
_get_path = test_base._get_path
L3_HOSTA = 'hosta'
DHCP_HOSTA = 'hosta'
L3_HOSTB = 'hostb'
@ -180,11 +180,11 @@ class AgentDBTestMixIn(object):
class AgentDBTestCase(AgentDBTestMixIn,
test_db_plugin.NeutronDbPluginV2TestCase):
test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
fmt = 'json'
def setUp(self):
plugin = 'neutron.tests.unit.test_agent_ext_plugin.TestAgentPlugin'
plugin = 'neutron.tests.unit.extensions.test_agent.TestAgentPlugin'
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
# Save the original RESOURCE_ATTRIBUTE_MAP

View File

@ -26,14 +26,14 @@ from neutron.db import models_v2
from neutron.extensions import external_net as external_net
from neutron import manager
from neutron.openstack.common import uuidutils
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.db import test_db_base_plugin_v2
LOG = logging.getLogger(__name__)
_uuid = uuidutils.generate_uuid
_get_path = test_api_v2._get_path
_get_path = test_base._get_path
class ExtNetTestExtensionManager(object):
@ -48,7 +48,7 @@ class ExtNetTestExtensionManager(object):
return []
class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
class ExtNetDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def _create_network(self, fmt, name, admin_state_up, **kwargs):
"""Override the routine for allowing the router:external attribute."""
@ -62,7 +62,7 @@ class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
fmt, name, admin_state_up, arg_list=arg_list, **new_args)
def setUp(self):
plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
ext_mgr = ExtNetTestExtensionManager()
super(ExtNetDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)

View File

@ -21,12 +21,12 @@ import webob.exc
from neutron.db import db_base_plugin_v2
from neutron.db import extradhcpopt_db as edo_db
from neutron.extensions import extra_dhcp_opt as edo_ext
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
LOG = logging.getLogger(__name__)
DB_PLUGIN_KLASS = (
'neutron.tests.unit.test_extension_extradhcpopts.ExtraDhcpOptTestPlugin')
'neutron.tests.unit.extensions.test_extra_dhcp_opt.ExtraDhcpOptTestPlugin')
class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
@ -53,7 +53,7 @@ class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
return rtn_port
class ExtraDhcpOptDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
class ExtraDhcpOptDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self, plugin=DB_PLUGIN_KLASS):
super(ExtraDhcpOptDBTestCase, self).setUp(plugin=plugin)

View File

@ -24,14 +24,14 @@ from neutron.db import extraroute_db
from neutron.extensions import extraroute
from neutron.extensions import l3
from neutron.openstack.common import uuidutils
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_l3_plugin as test_l3
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.extensions import test_l3 as test_l3
LOG = logging.getLogger(__name__)
_uuid = uuidutils.generate_uuid
_get_path = test_api_v2._get_path
_get_path = test_base._get_path
class ExtraRouteTestExtensionManager(object):
@ -459,7 +459,7 @@ class ExtraRouteDBIntTestCase(test_l3.L3NatDBIntTestCase,
def setUp(self, plugin=None, ext_mgr=None):
if not plugin:
plugin = ('neutron.tests.unit.test_extension_extraroute.'
plugin = ('neutron.tests.unit.extensions.test_extraroute.'
'TestExtraRouteIntPlugin')
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
@ -474,9 +474,9 @@ class ExtraRouteDBSepTestCase(test_l3.L3NatDBSepTestCase,
ExtraRouteDBTestCaseBase):
def setUp(self):
# the plugin without L3 support
plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
# the L3 service plugin
l3_plugin = ('neutron.tests.unit.test_extension_extraroute.'
l3_plugin = ('neutron.tests.unit.extensions.test_extraroute.'
'TestExtraRouteL3NatServicePlugin')
service_plugins = {'l3_plugin_name': l3_plugin}

View File

@ -47,15 +47,15 @@ from neutron.openstack.common import uuidutils
from neutron.plugins.common import constants as service_constants
from neutron.tests import base
from neutron.tests import fake_notifier
from neutron.tests.unit import test_agent_ext_plugin
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_api_v2_extension
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import base as test_extensions_base
from neutron.tests.unit.extensions import test_agent
LOG = logging.getLogger(__name__)
_uuid = uuidutils.generate_uuid
_get_path = test_api_v2._get_path
_get_path = test_base._get_path
class L3TestExtensionManager(object):
@ -76,7 +76,7 @@ class L3TestExtensionManager(object):
return []
class L3NatExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
class L3NatExtensionTestCase(test_extensions_base.ExtensionTestCase):
fmt = 'json'
def setUp(self):
@ -464,7 +464,7 @@ class L3NatTestCaseMixin(object):
private_port = None
if port_id:
private_port = self._show('ports', port_id)
with test_db_plugin.optional_ctx(private_port,
with test_db_base_plugin_v2.optional_ctx(private_port,
self.port) as private_port:
with self.router() as r:
sid = private_port['port']['fixed_ips'][0]['subnet_id']
@ -2431,13 +2431,13 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
self._test_notify_op_agent(self._test_floatingips_op_agent)
class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase):
class L3BaseForIntTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
mock_rescheduling = True
def setUp(self, plugin=None, ext_mgr=None, service_plugins=None):
if not plugin:
plugin = 'neutron.tests.unit.test_l3_plugin.TestL3NatIntPlugin'
plugin = 'neutron.tests.unit.extensions.test_l3.TestL3NatIntPlugin'
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
ext_mgr = ext_mgr or L3TestExtensionManager()
@ -2452,14 +2452,14 @@ class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase):
self.setup_notification_driver()
class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase):
class L3BaseForSepTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self, plugin=None, ext_mgr=None):
# the plugin without L3 support
if not plugin:
plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
# the L3 service plugin
l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
'TestL3NatServicePlugin')
service_plugins = {'l3_plugin_name': l3_plugin}
@ -2475,12 +2475,12 @@ class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase):
class L3NatDBIntAgentSchedulingTestCase(L3BaseForIntTests,
L3NatTestCaseMixin,
test_agent_ext_plugin.
test_agent.
AgentDBTestMixIn):
"""Unit tests for core plugin with L3 routing and scheduling integrated."""
def setUp(self, plugin='neutron.tests.unit.test_l3_plugin.'
def setUp(self, plugin='neutron.tests.unit.extensions.test_l3.'
'TestL3NatIntAgentSchedulingPlugin',
ext_mgr=None, service_plugins=None):
self.mock_rescheduling = False

View File

@ -27,8 +27,8 @@ from neutron.db import models_v2
from neutron.extensions import l3
from neutron.extensions import l3_ext_gw_mode
from neutron.openstack.common import uuidutils
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit import test_l3_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import test_l3
from neutron.tests.unit import testlib_api
_uuid = uuidutils.generate_uuid
@ -60,7 +60,7 @@ class TestExtensionManager(object):
# A simple class for making a concrete class out of the mixin
# for the case of a plugin that integrates l3 routing.
class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin,
class TestDbIntPlugin(test_l3.TestL3NatIntPlugin,
l3_gwmode_db.L3_NAT_db_mixin):
supported_extension_aliases = ["external-net", "router", "ext-gw-mode"]
@ -68,7 +68,7 @@ class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin,
# A simple class for making a concrete class out of the mixin
# for the case of a l3 router service plugin
class TestDbSepPlugin(test_l3_plugin.TestL3NatServicePlugin,
class TestDbSepPlugin(test_l3.TestL3NatServicePlugin,
l3_gwmode_db.L3_NAT_db_mixin):
supported_extension_aliases = ["router", "ext-gw-mode"]
@ -299,8 +299,8 @@ class TestL3GwModeMixin(testlib_api.SqlTestCase):
self.assertIsNone(router.get('enable_snat'))
class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
test_l3_plugin.L3NatTestCaseMixin):
class ExtGwModeIntTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
test_l3.L3NatTestCaseMixin):
def setUp(self, plugin=None, svc_plugins=None, ext_mgr=None):
# Store l3 resource attribute map as it will be updated
@ -309,7 +309,8 @@ class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
self._l3_attribute_map_bk[item] = (
l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
plugin = plugin or (
'neutron.tests.unit.test_extension_ext_gw_mode.TestDbIntPlugin')
'neutron.tests.unit.extensions.test_l3_ext_gw_mode.'
'TestDbIntPlugin')
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
ext_mgr = ext_mgr or TestExtensionManager()
@ -430,9 +431,9 @@ class ExtGwModeSepTestCase(ExtGwModeIntTestCase):
self._l3_attribute_map_bk[item] = (
l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
plugin = plugin or (
'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin')
'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin')
# the L3 service plugin
l3_plugin = ('neutron.tests.unit.test_extension_ext_gw_mode.'
l3_plugin = ('neutron.tests.unit.extensions.test_l3_ext_gw_mode.'
'TestDbSepPlugin')
svc_plugins = {'l3_plugin_name': l3_plugin}
# for these tests we need to enable overlapping ips

View File

@ -16,7 +16,7 @@ from neutron.common import constants
from neutron.db import db_base_plugin_v2
from neutron.db import netmtu_db
from neutron.extensions import netmtu
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
class NetmtuExtensionManager(object):
@ -42,12 +42,12 @@ class NetmtuExtensionTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
supported_extension_aliases = ["net-mtu"]
class NetmtuExtensionTestCase(test_db_plugin.TestNetworksV2):
class NetmtuExtensionTestCase(test_db_base_plugin_v2.TestNetworksV2):
"""Test API extension net-mtu attributes.
"""
def setUp(self):
plugin = ('neutron.tests.unit.test_extension_netmtu.' +
plugin = ('neutron.tests.unit.extensions.test_netmtu.' +
'NetmtuExtensionTestPlugin')
ext_mgr = NetmtuExtensionManager()
super(NetmtuExtensionTestCase, self).setUp(plugin=plugin,

View File

@ -23,20 +23,20 @@ from neutron.db import securitygroups_db
from neutron.extensions import portsecurity as psec
from neutron.extensions import securitygroup as ext_sg
from neutron import manager
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit import test_extension_security_group
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import test_securitygroup
DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_portsecurity.'
DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_portsecurity.'
'PortSecurityTestPlugin')
class PortSecurityTestCase(
test_extension_security_group.SecurityGroupsTestCase,
test_db_plugin.NeutronDbPluginV2TestCase):
test_securitygroup.SecurityGroupsTestCase,
test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self, plugin=None):
ext_mgr = (
test_extension_security_group.SecurityGroupTestExtensionManager())
test_securitygroup.SecurityGroupTestExtensionManager())
super(PortSecurityTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
# Check if a plugin supports security groups

View File

@ -26,8 +26,8 @@ from neutron.extensions import providernet as pnet
from neutron import manager
from neutron.openstack.common import uuidutils
from neutron import quota
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_extensions
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit import testlib_api
@ -101,9 +101,9 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
instance.get_network.return_value = {'tenant_id': ctx.tenant_id,
'shared': False}
net_id = uuidutils.generate_uuid()
res = self.api.put(test_api_v2._get_path('networks',
id=net_id,
fmt=self.fmt),
res = self.api.put(test_base._get_path('networks',
id=net_id,
fmt=self.fmt),
self.serialize({'network': data}),
extra_environ=env,
expect_errors=expect_errors)
@ -112,7 +112,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
def _post_network_with_provider_attrs(self, ctx, expect_errors=False):
data = self._prepare_net_data()
env = {'neutron.context': ctx}
res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt),
res = self.api.post(test_base._get_path('networks', fmt=self.fmt),
self.serialize({'network': data}),
content_type='application/' + self.fmt,
extra_environ=env,
@ -124,7 +124,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
data = self._prepare_net_data()
data.update(bad_data)
env = {'neutron.context': ctx}
res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt),
res = self.api.post(test_base._get_path('networks', fmt=self.fmt),
self.serialize({'network': data}),
content_type='application/' + self.fmt,
extra_environ=env,

View File

@ -30,12 +30,12 @@ from neutron import context
from neutron.db import quota_db
from neutron import quota
from neutron.tests import base
from neutron.tests.unit import test_api_v2
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit import testlib_api
TARGET_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin'
_get_path = test_api_v2._get_path
_get_path = test_base._get_path
class QuotaExtensionTestCase(testlib_api.WebTestCase):

View File

@ -29,9 +29,9 @@ from neutron.db import securitygroups_db
from neutron.extensions import securitygroup as ext_sg
from neutron import manager
from neutron.tests import base
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_security_group.'
DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_securitygroup.'
'SecurityGroupTestPlugin')
@ -53,7 +53,7 @@ class SecurityGroupTestExtensionManager(object):
return []
class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
class SecurityGroupsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def _create_security_group(self, fmt, name, description, **kwargs):

View File

@ -25,18 +25,18 @@ from neutron.db import servicetype_db as st_db
from neutron.extensions import servicetype
from neutron.plugins.common import constants
from neutron.services import provider_configuration as provconf
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit import dummy_plugin as dp
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit import test_extensions
from neutron.tests.unit import testlib_api
DEFAULT_SERVICE_DEFS = [{'service_class': constants.DUMMY,
'plugin': dp.DUMMY_PLUGIN_NAME}]
_uuid = test_api_v2._uuid
_get_path = test_api_v2._get_path
_uuid = test_base._uuid
_get_path = test_base._get_path
class ServiceTypeManagerTestCase(testlib_api.SqlTestCase):
@ -165,7 +165,7 @@ class ServiceTypeExtensionTestCaseBase(testlib_api.WebTestCase):
def setUp(self):
# This is needed because otherwise a failure will occur due to
# nonexisting core_plugin
self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS)
self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS)
cfg.CONF.set_override('service_plugins',
["%s.%s" % (dp.__name__,

View File

@ -24,7 +24,7 @@ import neutron.ipam as ipam
from neutron.ipam import subnet_alloc
from neutron import manager
from neutron.openstack.common import uuidutils
from neutron.tests.unit import test_db_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit import testlib_api
@ -33,7 +33,7 @@ class TestSubnetAllocation(testlib_api.SqlTestCase):
def setUp(self):
super(TestSubnetAllocation, self).setUp()
self._tenant_id = 'test-tenant'
self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS)
self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS)
self.plugin = manager.NeutronManager.get_plugin()
self.ctx = context.get_admin_context()
cfg.CONF.set_override('allow_overlapping_ips', True)

View File

@ -21,7 +21,7 @@ import uuid
from neutron import context
from neutron.plugins.brocade.db import models as brocade_db
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
TEST_VLAN = 1000

View File

@ -20,7 +20,7 @@ from oslo_utils import importutils
from neutron.extensions import portbindings
from neutron.plugins.brocade import NeutronPlugin as brocade_plugin
from neutron.tests.unit import _test_extension_portbindings as test_bindings
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
PLUGIN_NAME = ('neutron.plugins.brocade.'

View File

@ -24,7 +24,7 @@ from neutron.plugins.cisco.common import cisco_constants as c_const
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
from neutron.plugins.cisco.db import n1kv_db_v2
from neutron.plugins.cisco.db import n1kv_models_v2
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
from neutron.tests.unit import testlib_api

View File

@ -34,11 +34,11 @@ from neutron.plugins.cisco.extensions import policy_profile
from neutron.plugins.cisco.n1kv import n1kv_client
from neutron.plugins.cisco.n1kv import n1kv_neutron_plugin
from neutron.tests.unit import _test_extension_portbindings as test_bindings
from neutron.tests.unit.cisco.n1kv import fake_client
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit import test_l3_plugin
from neutron.tests.unit import test_l3_schedulers
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
from neutron.tests.unit.extensions import test_l3
from neutron.tests.unit.plugins.cisco.n1kv import fake_client
from neutron.tests.unit.scheduler import test_l3_agent_scheduler
PHYS_NET = 'some-phys-net'
@ -128,7 +128,7 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
create. Default argument value chosen to correspond to the
default name specified in config.py file.
"""
uuid = test_api_v2._uuid()
uuid = test_base._uuid()
profile = {'id': uuid,
'name': name}
return n1kv_db_v2.create_policy_profile(profile)
@ -1281,11 +1281,11 @@ class TestN1kvSubnets(test_plugin.TestSubnetsV2,
self.assertEqual(1, mock_method.call_count)
class TestN1kvL3Test(test_l3_plugin.L3NatExtensionTestCase):
class TestN1kvL3Test(test_l3.L3NatExtensionTestCase):
pass
class TestN1kvL3SchedulersTest(test_l3_schedulers.L3SchedulerTestCase):
class TestN1kvL3SchedulersTest(test_l3_agent_scheduler.L3SchedulerTestCase):
pass

View File

@ -16,7 +16,7 @@
from oslo_config import cfg
from neutron.plugins.embrane.common import config # noqa
from neutron.tests.unit import test_extension_extraroute as extraroute_test
from neutron.tests.unit.extensions import test_extraroute as extraroute_test
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
'EmbraneFakePlugin')

View File

@ -18,7 +18,7 @@ import mock
from oslo_config import cfg
from neutron.plugins.embrane.common import config # noqa
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
'EmbraneFakePlugin')

View File

@ -20,8 +20,8 @@ import mock
from neutron.extensions import portbindings
from neutron.tests.unit import _test_extension_portbindings as test_bindings
from neutron.tests.unit import test_db_plugin as test_plugin
from neutron.tests.unit import test_l3_plugin as test_l3_plugin
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
from neutron.tests.unit.extensions import test_l3 as test_l3
from neutron.plugins.ibm.common import constants
@ -111,7 +111,7 @@ class TestIBMPortBinding(IBMPluginV2TestCase,
VIF_TYPE = portbindings.VIF_TYPE_OVS
class IBMPluginRouterTestCase(test_l3_plugin.L3NatDBIntTestCase):
class IBMPluginRouterTestCase(test_l3.L3NatDBIntTestCase):
def setUp(self):
with contextlib.nested(

View File

@ -24,7 +24,7 @@ from neutron.extensions import portbindings
from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as md
from neutron.plugins.ml2.drivers import type_vlan # noqa
from neutron.tests import base
from neutron.tests.unit.ml2.drivers.cisco.apic import (
from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import (
test_cisco_apic_common as mocked)

View File

@ -21,7 +21,7 @@ sys.modules["apicapi"] = mock.Mock()
from neutron.plugins.ml2.drivers.cisco.apic import apic_topology
from neutron.tests import base
from neutron.tests.unit.ml2.drivers.cisco.apic import (
from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import (
test_cisco_apic_common as mocked)
NOTIFIER = ('neutron.plugins.ml2.drivers.cisco.apic.'

View File

@ -14,7 +14,7 @@
# under the License.
from neutron.plugins.ml2.drivers.cisco.ncs import driver
from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin
class NCSTestCase(test_plugin.Ml2PluginV2TestCase):

View File

@ -26,7 +26,7 @@ from neutron.api.v2 import attributes
from neutron.db import model_base
from neutron.db import models_v2
from neutron.plugins.ml2 import driver_api
from neutron.tests.unit.ml2 import extensions as test_extensions
from neutron.tests.unit.plugins.ml2 import extensions as test_extensions
class TestExtensionDriverBase(driver_api.ExtensionDriver):

Some files were not shown because too many files have changed in this diff Show More