Merge "Rename GlanceImageService.get to download"

This commit is contained in:
Jenkins 2012-06-28 14:41:19 +00:00 committed by Gerrit Code Review
commit 01ffa3c0a1
2 changed files with 13 additions and 13 deletions

View File

@ -33,11 +33,10 @@ from nova import log as logging
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.openstack.common import timeutils from nova.openstack.common import timeutils
from nova import test from nova import test
import nova.tests.api.openstack.fakes as api_fakes
from nova.tests.db import fakes as db_fakes from nova.tests.db import fakes as db_fakes
from nova.tests import fake_network from nova.tests import fake_network
from nova.tests import fake_utils from nova.tests import fake_utils
import nova.tests.image.fake import nova.tests.image.fake as fake_image
from nova.tests.xenapi import stubs from nova.tests.xenapi import stubs
from nova.virt.xenapi import connection as xenapi_conn from nova.virt.xenapi import connection as xenapi_conn
from nova.virt.xenapi import fake as xenapi_fake from nova.virt.xenapi import fake as xenapi_fake
@ -92,7 +91,7 @@ IMAGE_FIXTURES = {
def set_image_fixtures(): def set_image_fixtures():
image_service = nova.tests.image.fake.FakeImageService() image_service = fake_image.FakeImageService()
image_service.delete_all() image_service.delete_all()
for image_id, image_meta in IMAGE_FIXTURES.items(): for image_id, image_meta in IMAGE_FIXTURES.items():
image_meta = image_meta['image_meta'] image_meta = image_meta['image_meta']
@ -113,23 +112,23 @@ def stub_vm_utils_with_vdi_attached_here(function, should_return=True):
fake_dev = 'fakedev' fake_dev = 'fakedev'
yield fake_dev yield fake_dev
def fake_image_get(*args, **kwargs): def fake_image_download(*args, **kwargs):
pass pass
def fake_is_vdi_pv(*args, **kwargs): def fake_is_vdi_pv(*args, **kwargs):
return should_return return should_return
orig_vdi_attached_here = vm_utils.vdi_attached_here orig_vdi_attached_here = vm_utils.vdi_attached_here
orig_image_get = nova.tests.image.fake._FakeImageService.get orig_image_download = fake_image._FakeImageService.download
orig_is_vdi_pv = vm_utils._is_vdi_pv orig_is_vdi_pv = vm_utils._is_vdi_pv
try: try:
vm_utils.vdi_attached_here = fake_vdi_attached_here vm_utils.vdi_attached_here = fake_vdi_attached_here
nova.tests.image.fake._FakeImageService.get = fake_image_get fake_image._FakeImageService.download = fake_image_download
vm_utils._is_vdi_pv = fake_is_vdi_pv vm_utils._is_vdi_pv = fake_is_vdi_pv
return function(self, *args, **kwargs) return function(self, *args, **kwargs)
finally: finally:
vm_utils._is_vdi_pv = orig_is_vdi_pv vm_utils._is_vdi_pv = orig_is_vdi_pv
nova.tests.image.fake._FakeImageService.get = orig_image_get fake_image._FakeImageService.download = orig_image_download
vm_utils.vdi_attached_here = orig_vdi_attached_here vm_utils.vdi_attached_here = orig_vdi_attached_here
return decorated_function return decorated_function
@ -278,14 +277,14 @@ class XenAPIVMTestCase(test.TestCase):
self.context = context.RequestContext(self.user_id, self.project_id) self.context = context.RequestContext(self.user_id, self.project_id)
self.conn = xenapi_conn.XenAPIDriver(False) self.conn = xenapi_conn.XenAPIDriver(False)
nova.tests.image.fake.stub_out_image_service(self.stubs) fake_image.stub_out_image_service(self.stubs)
set_image_fixtures() set_image_fixtures()
stubs.stubout_image_service_get(self.stubs) stubs.stubout_image_service_download(self.stubs)
stubs.stubout_stream_disk(self.stubs) stubs.stubout_stream_disk(self.stubs)
def tearDown(self): def tearDown(self):
super(XenAPIVMTestCase, self).tearDown() super(XenAPIVMTestCase, self).tearDown()
nova.tests.image.fake.FakeImageService_reset() fake_image.FakeImageService_reset()
def test_init_host(self): def test_init_host(self):
session = xenapi_conn.XenAPISession('test_url', 'root', 'test_pass') session = xenapi_conn.XenAPISession('test_url', 'root', 'test_pass')

View File

@ -82,10 +82,11 @@ def stubout_get_this_vm_uuid(stubs):
stubs.Set(vm_utils, 'get_this_vm_uuid', f) stubs.Set(vm_utils, 'get_this_vm_uuid', f)
def stubout_image_service_get(stubs): def stubout_image_service_download(stubs):
def fake_get(*args, **kwargs): def fake_download(*args, **kwargs):
pass pass
stubs.Set(nova.tests.image.fake._FakeImageService, 'get', fake_get) stubs.Set(nova.tests.image.fake._FakeImageService,
'download', fake_download)
def stubout_stream_disk(stubs): def stubout_stream_disk(stubs):