tests: don't configure plugin for tests that don't need it

Except test_subnet, there are no more object tests that would require
the plugin configured, so let's not go through the hassle of setting it
up. (For the record, this setup was not needed since
If1252c42c49cd59dba7ec7c02c9b887fdc169f51).

Change-Id: Iafb886c17dbf9a91a3514b0caa1bcd14093a796c
This commit is contained in:
Ihar Hrachyshka 2018-04-12 15:56:06 -07:00
parent a0bbfba8c5
commit 5cf6663b9f
3 changed files with 5 additions and 14 deletions

View File

@ -25,9 +25,6 @@ from neutron.tests import base as test_base
from neutron.tests.unit import testlib_api from neutron.tests.unit import testlib_api
PLUGIN_NAME = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
class FakeModel(object): class FakeModel(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
pass pass
@ -39,12 +36,6 @@ class FakeObj(base.NeutronDbObject):
class GetObjectsTestCase(test_base.BaseTestCase): class GetObjectsTestCase(test_base.BaseTestCase):
def setUp(self):
super(GetObjectsTestCase, self).setUp()
# TODO(ihrachys): revisit plugin setup once we decouple
# objects.db.objects.api from core plugin instance
self.setup_coreplugin(PLUGIN_NAME)
def test_get_objects_pass_marker_obj_when_limit_and_marker_passed(self): def test_get_objects_pass_marker_obj_when_limit_and_marker_passed(self):
ctxt = context.get_admin_context() ctxt = context.get_admin_context()
marker = mock.sentinel.marker marker = mock.sentinel.marker

View File

@ -559,13 +559,8 @@ class _BaseObjectTestCase(object):
_test_class = FakeNeutronDbObject _test_class = FakeNeutronDbObject
CORE_PLUGIN = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
def setUp(self): def setUp(self):
super(_BaseObjectTestCase, self).setUp() super(_BaseObjectTestCase, self).setUp()
# TODO(ihrachys): revisit plugin setup once we decouple
# neutron.objects.db.api from core plugin instance
self.setup_coreplugin(self.CORE_PLUGIN)
# make sure all objects are loaded and registered in the registry # make sure all objects are loaded and registered in the registry
objects.register_objects() objects.register_objects()
self.context = context.get_admin_context() self.context = context.get_admin_context()

View File

@ -148,8 +148,13 @@ class SubnetDbObjectTestCase(obj_test_base.BaseDbObjectTestCase,
_test_class = subnet.Subnet _test_class = subnet.Subnet
CORE_PLUGIN = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
def setUp(self): def setUp(self):
super(SubnetDbObjectTestCase, self).setUp() super(SubnetDbObjectTestCase, self).setUp()
# set up plugin because some models used here require a plugin
# (specifically, rbac models and their get_valid_actions validators)
self.setup_coreplugin(self.CORE_PLUGIN)
network_id = self._create_test_network_id() network_id = self._create_test_network_id()
self.update_obj_fields( self.update_obj_fields(
{'network_id': network_id, {'network_id': network_id,