Merge "Stop using mox in api/openstack/fakes.py"

This commit is contained in:
Zuul 2018-02-28 19:54:55 +00:00 committed by Gerrit Code Review
commit c1b9450f5d
3 changed files with 7 additions and 9 deletions

View File

@ -53,8 +53,8 @@ class ImagesControllerTestV21(test.NoDBTestCase):
self.flags(api_servers=['http://localhost:9292'], group='glance')
fakes.stub_out_networking(self)
fakes.stub_out_key_pair_funcs(self)
fakes.stub_out_compute_api_snapshot(self.stubs)
fakes.stub_out_compute_api_backup(self.stubs)
fakes.stub_out_compute_api_snapshot(self)
fakes.stub_out_compute_api_backup(self)
self.controller = self.image_controller_class()
self.url_prefix = "http://localhost%s/images" % self.url_base

View File

@ -84,7 +84,7 @@ class ServerActionsControllerTestV21(test.TestCase):
instance_update_and_get_original)
fakes.stub_out_nw_api(self)
fakes.stub_out_compute_api_snapshot(self.stubs)
fakes.stub_out_compute_api_snapshot(self)
fake.stub_out_image_service(self)
self.flags(allow_instance_snapshots=True,
enable_instance_password=True,

View File

@ -30,7 +30,6 @@ from nova.api.openstack import compute
from nova.api.openstack.compute import versions
from nova.api.openstack import urlmap
from nova.api.openstack import wsgi as os_wsgi
from nova.compute import api as compute_api
from nova.compute import flavors
from nova.compute import vm_states
import nova.conf
@ -128,7 +127,7 @@ def stub_out_networking(test):
test.stub_out('oslo_utils.netutils.get_my_ipv4', get_my_ip)
def stub_out_compute_api_snapshot(stubs):
def stub_out_compute_api_snapshot(test):
def snapshot(self, context, instance, name, extra_properties=None):
# emulate glance rejecting image names which are too long
@ -137,15 +136,14 @@ def stub_out_compute_api_snapshot(stubs):
return dict(id='123', status='ACTIVE', name=name,
properties=extra_properties)
stubs.Set(compute_api.API, 'snapshot', snapshot)
test.stub_out('nova.compute.api.API.snapshot', snapshot)
class stub_out_compute_api_backup(object):
def __init__(self, stubs):
self.stubs = stubs
def __init__(self, test):
self.extra_props_last_call = None
stubs.Set(compute_api.API, 'backup', self.backup)
test.stub_out('nova.compute.api.API.backup', self.backup)
def backup(self, context, instance, name, backup_type, rotation,
extra_properties=None):