Merge "Removes unnecessary Embrane module-level mocks"
This commit is contained in:
commit
81bc23fd4f
|
@ -17,17 +17,11 @@
|
|||
#
|
||||
# @author: Ivar Lazzaro, Embrane, Inc.
|
||||
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.plugins.embrane.common import config # noqa
|
||||
from neutron.tests import base
|
||||
|
||||
# Need to mock heleosapi.
|
||||
sys.modules["heleosapi"] = mock.Mock()
|
||||
|
||||
|
||||
class ConfigurationTest(base.BaseTestCase):
|
||||
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
#
|
||||
# @author: Ivar Lazzaro, Embrane, Inc.
|
||||
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.db import api as db
|
||||
|
@ -29,7 +26,6 @@ from neutron.tests.unit import test_l3_plugin as router_test
|
|||
|
||||
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
|
||||
'EmbraneFakePlugin')
|
||||
sys.modules["heleosapi"] = mock.Mock()
|
||||
|
||||
|
||||
class TestEmbraneL3NatDBTestCase(router_test.L3NatDBIntTestCase):
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# under the License.
|
||||
#
|
||||
# @author: Ivar Lazzaro, Embrane, Inc.
|
||||
|
||||
import sys
|
||||
|
||||
import mock
|
||||
|
@ -28,7 +27,6 @@ from neutron.tests.unit import test_db_plugin as test_plugin
|
|||
|
||||
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
|
||||
'EmbraneFakePlugin')
|
||||
sys.modules["heleosapi"] = mock.Mock()
|
||||
|
||||
|
||||
class EmbranePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
|
@ -36,7 +34,11 @@ class EmbranePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||
|
||||
def setUp(self):
|
||||
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
||||
p = mock.patch.dict(sys.modules, {'heleosapi': mock.Mock()})
|
||||
p.start()
|
||||
self.addCleanup(db.clear_db)
|
||||
# dict patches must be explicitly stopped
|
||||
self.addCleanup(p.stop)
|
||||
super(EmbranePluginV2TestCase, self).setUp(self._plugin_name)
|
||||
|
||||
|
||||
|
|
|
@ -17,16 +17,11 @@
|
|||
#
|
||||
# @author: Ivar Lazzaro, Embrane, Inc.
|
||||
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.services.loadbalancer.drivers.embrane import config # noqa
|
||||
from neutron.tests import base
|
||||
|
||||
sys.modules["heleosapi"] = mock.Mock()
|
||||
|
||||
|
||||
class ConfigurationTest(base.BaseTestCase):
|
||||
|
||||
|
|
|
@ -20,16 +20,19 @@
|
|||
import sys
|
||||
|
||||
import mock
|
||||
sys.modules["heleosapi"] = mock.Mock()
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron import context
|
||||
from neutron.openstack.common.db import exception as n_exc
|
||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||
|
||||
HELEOSAPIMOCK = mock.Mock()
|
||||
sys.modules["heleosapi"] = HELEOSAPIMOCK
|
||||
from neutron.services.loadbalancer.drivers.embrane import config # noqa
|
||||
from neutron.services.loadbalancer.drivers.embrane import constants as h_con
|
||||
from neutron.services.loadbalancer.drivers.embrane import db as h_db
|
||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||
|
||||
# Stop the mock from persisting indefinitely in the global modules space
|
||||
del sys.modules["heleosapi"]
|
||||
|
||||
EMBRANE_PROVIDER = ('LOADBALANCER:lbaas:neutron.services.'
|
||||
'loadbalancer.drivers.embrane.driver.'
|
||||
|
@ -42,10 +45,12 @@ class TestLoadBalancerPluginBase(
|
|||
def setUp(self):
|
||||
cfg.CONF.set_override('admin_password', "admin123", 'heleoslb')
|
||||
cfg.CONF.set_override('sync_interval', 0, 'heleoslb')
|
||||
|
||||
mock.patch.dict(sys.modules, {'heleosapi': HELEOSAPIMOCK}).start()
|
||||
super(TestLoadBalancerPluginBase, self).setUp(
|
||||
lbaas_provider=EMBRANE_PROVIDER)
|
||||
self.driver = self.plugin.drivers['lbaas']
|
||||
# prevent module mock from saving calls between tests
|
||||
self.addCleanup(HELEOSAPIMOCK.reset_mock)
|
||||
|
||||
|
||||
class TestLoadBalancerPlugin(test_db_loadbalancer.TestLoadBalancer,
|
||||
|
|
Loading…
Reference in New Issue