Stop using mox stubs in tests/unit/fake_notifier

Replace 'stubs.Set' with 'stub_out' in the following files.

* nova/tests/unit/fake_notifier.py

Change-Id: Ie161780e748e3e8f1959a99d6d69e3518ccc958e
Implements: blueprint remove-mox-newton
This commit is contained in:
Balazs Gibizer 2016-06-10 11:12:46 +02:00
parent 520ee65a55
commit 55469df239
8 changed files with 21 additions and 22 deletions

View File

@ -47,8 +47,7 @@ class NotificationSampleTestBase(test.TestCase):
self.api = api_fixture.api
self.admin_api = api_fixture.admin_api
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
def _get_notification_sample(self, sample):

View File

@ -155,7 +155,7 @@ class BaseTestCase(test.TestCase):
fake.set_nodes([NODENAME])
self.flags(use_local=True, group='conductor')
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.compute = importutils.import_object(CONF.compute_manager)

View File

@ -394,7 +394,7 @@ class UsageInfoTestCase(test.TestCase):
self.stubs.Set(network_api.API, 'get_instance_nw_info',
fake_get_nw_info)
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.flags(use_local=True, group='conductor')

View File

@ -35,7 +35,7 @@ class ComputeHostAPITestCase(test.TestCase):
super(ComputeHostAPITestCase, self).setUp()
self.host_api = compute.HostAPI()
self.ctxt = context.get_admin_context()
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
def _compare_obj(self, obj, db_obj):

View File

@ -73,7 +73,7 @@ class _BaseTestCase(object):
self.project_id = fakes.FAKE_PROJECT_ID
self.context = FakeContext(self.user_id, self.project_id)
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
def fake_deserialize_context(serializer, ctxt_dict):

View File

@ -75,18 +75,18 @@ class FakeVersionedNotifier(FakeNotifier):
'payload': payload})
def stub_notifier(stubs):
stubs.Set(messaging, 'Notifier', FakeNotifier)
def stub_notifier(test):
test.stub_out('oslo_messaging.Notifier', FakeNotifier)
if rpc.LEGACY_NOTIFIER and rpc.NOTIFIER:
stubs.Set(rpc, 'LEGACY_NOTIFIER',
FakeNotifier(rpc.LEGACY_NOTIFIER.transport,
rpc.LEGACY_NOTIFIER.publisher_id,
serializer=getattr(rpc.LEGACY_NOTIFIER,
'_serializer',
None)))
stubs.Set(rpc, 'NOTIFIER',
FakeVersionedNotifier(rpc.NOTIFIER.transport,
rpc.NOTIFIER.publisher_id,
serializer=getattr(rpc.NOTIFIER,
'_serializer',
None)))
test.stub_out('nova.rpc.LEGACY_NOTIFIER',
FakeNotifier(rpc.LEGACY_NOTIFIER.transport,
rpc.LEGACY_NOTIFIER.publisher_id,
serializer=getattr(rpc.LEGACY_NOTIFIER,
'_serializer',
None)))
test.stub_out('nova.rpc.NOTIFIER',
FakeVersionedNotifier(rpc.NOTIFIER.transport,
rpc.NOTIFIER.publisher_id,
serializer=getattr(rpc.NOTIFIER,
'_serializer',
None)))

View File

@ -239,7 +239,7 @@ class _BaseTestCase(test.TestCase):
self.user_id = 'fake-user'
self.project_id = 'fake-project'
self.context = context.RequestContext(self.user_id, self.project_id)
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
# NOTE(danms): register these here instead of at import time

View File

@ -52,7 +52,7 @@ class NotificationsTestCase(test.TestCase):
fake_get_nw_info)
fake_network.set_stub_network_methods(self)
fake_notifier.stub_notifier(self.stubs)
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.flags(network_manager='nova.network.manager.FlatManager',