From d3b5f5cbf0dd5dd407938a238c2bb2d1c9e39137 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Wed, 27 Jun 2012 12:24:17 -0700 Subject: [PATCH] Rename GlanceImageService.get to download In preparation for integration with the new Glance client, this drops the return of image metadata from GlanceImageService.get in addition to renaming it to 'download'. Change-Id: I75ca3a0a909335e74cd521da6f894c163e773e94 --- nova/tests/test_xenapi.py | 19 +++++++++---------- nova/tests/xenapi/stubs.py | 7 ++++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index ca3fb326..668172a9 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -33,11 +33,10 @@ from nova import log as logging from nova.openstack.common import importutils from nova.openstack.common import timeutils 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 import fake_network 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.virt.xenapi import connection as xenapi_conn from nova.virt.xenapi import fake as xenapi_fake @@ -92,7 +91,7 @@ IMAGE_FIXTURES = { def set_image_fixtures(): - image_service = nova.tests.image.fake.FakeImageService() + image_service = fake_image.FakeImageService() image_service.delete_all() for image_id, image_meta in IMAGE_FIXTURES.items(): 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' yield fake_dev - def fake_image_get(*args, **kwargs): + def fake_image_download(*args, **kwargs): pass def fake_is_vdi_pv(*args, **kwargs): return should_return 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 try: 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 return function(self, *args, **kwargs) finally: 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 return decorated_function @@ -278,14 +277,14 @@ class XenAPIVMTestCase(test.TestCase): self.context = context.RequestContext(self.user_id, self.project_id) 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() - stubs.stubout_image_service_get(self.stubs) + stubs.stubout_image_service_download(self.stubs) stubs.stubout_stream_disk(self.stubs) def tearDown(self): super(XenAPIVMTestCase, self).tearDown() - nova.tests.image.fake.FakeImageService_reset() + fake_image.FakeImageService_reset() def test_init_host(self): session = xenapi_conn.XenAPISession('test_url', 'root', 'test_pass') diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index 0116c4d9..47b950e0 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -82,10 +82,11 @@ def stubout_get_this_vm_uuid(stubs): stubs.Set(vm_utils, 'get_this_vm_uuid', f) -def stubout_image_service_get(stubs): - def fake_get(*args, **kwargs): +def stubout_image_service_download(stubs): + def fake_download(*args, **kwargs): 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):