Merge "Stop using mox stubs in tests/unit/fake_notifier"
This commit is contained in:
commit
432995d1eb
@ -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):
|
||||
|
@ -154,7 +154,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)
|
||||
|
@ -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')
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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)))
|
||||
|
@ -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
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user