Merge "TestTrackedResource: register core plugin in directory"

This commit is contained in:
Jenkins 2017-03-31 20:12:59 +00:00 committed by Gerrit Code Review
commit 2a819bd39a
1 changed files with 5 additions and 12 deletions

View File

@ -60,7 +60,7 @@ class TestResource(base.DietTestCase):
self.assertEqual(-1, res.default)
class TestTrackedResource(testlib_api.SqlTestCaseLight):
class TestTrackedResource(testlib_api.SqlTestCase):
def _add_data(self, tenant_id=None):
session = db_api.get_writer_session()
@ -91,31 +91,24 @@ class TestTrackedResource(testlib_api.SqlTestCaseLight):
session.add(item)
def setUp(self):
base.BaseTestCase.config_parse()
cfg.CONF.register_opts(meh_quota_opts, 'QUOTAS')
cfg.CONF.set_override("core_plugin", DB_PLUGIN_KLASS)
self.addCleanup(cfg.CONF.reset)
super(TestTrackedResource, self).setUp()
self.setup_coreplugin(DB_PLUGIN_KLASS)
self.resource = 'meh'
self.other_resource = 'othermeh'
self.tenant_id = 'meh'
self.context = context.Context(
user_id='', tenant_id=self.tenant_id, is_admin=False)
super(TestTrackedResource, self).setUp()
def _register_events(self, res):
res.register_events()
self.addCleanup(res.unregister_events)
def _create_resource(self):
res = resource.TrackedResource(
self.resource, test_quota.MehModel, meh_quota_flag)
self._register_events(res)
res.register_events()
return res
def _create_other_resource(self):
res = resource.TrackedResource(
self.other_resource, test_quota.OtherMehModel, meh_quota_flag)
self._register_events(res)
res.register_events()
return res
def test_bulk_delete_protection(self):