Stop using mox from unit/fake_server_actions.py

Stop using stubs.Set() from tests/unit/fake_server_actions.py
and related files.

Part of blueprint remove-mox-newton

Change-Id: I00b9d618a86720cd71ee18b0fba8f5b4f913e82c
This commit is contained in:
Dao Cong Tien 2016-06-02 14:31:21 +07:00
parent cdfa50599c
commit ababf7391e
6 changed files with 8 additions and 10 deletions

View File

@ -35,7 +35,7 @@ class ComputeManagerTestCase(test.TestCase):
self.start_service('scheduler')
self.compute = self.start_service('compute')
self.context = context.RequestContext('fake', 'fake')
fake_server_actions.stub_out_action_events(self.stubs)
fake_server_actions.stub_out_action_events(self)
fake_network.set_stub_network_methods(self)
def test_instance_fault_message_no_traceback_with_retry(self):

View File

@ -237,7 +237,7 @@ class BaseTestCase(test.TestCase):
self.stubs.Set(self.compute, 'compute_task_api', fake_taskapi)
fake_network.set_stub_network_methods(self)
fake_server_actions.stub_out_action_events(self.stubs)
fake_server_actions.stub_out_action_events(self)
def fake_get_nw_info(cls, ctxt, instance, *args, **kwargs):
return network_model.NetworkInfo()

View File

@ -412,7 +412,7 @@ class UsageInfoTestCase(test.TestCase):
self.stubs.Set(nova.tests.unit.image.fake._FakeImageService,
'show', fake_show)
fake_network.set_stub_network_methods(self)
fake_server_actions.stub_out_action_events(self.stubs)
fake_server_actions.stub_out_action_events(self)
def test_notify_usage_exists(self):
# Ensure 'exists' notification generates appropriate usage data.

View File

@ -285,7 +285,7 @@ class _BaseTaskTestCase(object):
self.user_id = fakes.FAKE_USER_ID
self.project_id = fakes.FAKE_PROJECT_ID
self.context = FakeContext(self.user_id, self.project_id)
fake_server_actions.stub_out_action_events(self.stubs)
fake_server_actions.stub_out_action_events(self)
def fake_deserialize_context(serializer, ctxt_dict):
self.assertEqual(self.context.user_id, ctxt_dict['user_id'])

View File

@ -14,8 +14,6 @@
import datetime
from nova import db
FAKE_UUID = 'b48316c5-71e8-45e4-9884-6c78055b9b13'
FAKE_REQUEST_ID1 = 'req-3293a3f1-b44c-4609-b8d2-d81b105636b8'
@ -114,6 +112,6 @@ def fake_action_event_finish(*args):
return FAKE_EVENTS[FAKE_ACTION_ID1][0]
def stub_out_action_events(stubs):
stubs.Set(db, 'action_event_start', fake_action_event_start)
stubs.Set(db, 'action_event_finish', fake_action_event_finish)
def stub_out_action_events(test):
test.stub_out('nova.db.action_event_start', fake_action_event_start)
test.stub_out('nova.db.action_event_finish', fake_action_event_finish)

View File

@ -107,7 +107,7 @@ class SchedulerManagerTestCase(test.NoDBTestCase):
self.topic = 'fake_topic'
self.fake_args = (1, 2, 3)
self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
fake_server_actions.stub_out_action_events(self.stubs)
fake_server_actions.stub_out_action_events(self)
def test_1_correct_init(self):
# Correct scheduler driver