This commit is contained in:
Armando Migliaccio 2010-12-25 12:47:20 +00:00 committed by Tarmac
commit bd6a3cb1ac
2 changed files with 12 additions and 2 deletions

View File

@ -48,6 +48,7 @@ class XenAPIVolumeTestCase(test.TestCase):
FLAGS.xenapi_connection_url = 'test_url'
FLAGS.xenapi_connection_password = 'test_pass'
fakes.stub_out_db_instance_api(self.stubs)
stubs.stub_out_get_target(self.stubs)
fake.reset()
self.values = {'name': 1, 'id': 1,
'project_id': 'fake',

View File

@ -18,12 +18,13 @@
from nova.virt import xenapi_conn
from nova.virt.xenapi import fake
from nova.virt.xenapi import volume_utils
def stubout_session(stubs, cls):
""" Stubs out two methods from XenAPISession """
"""Stubs out two methods from XenAPISession"""
def fake_import(self):
""" Stubs out get_imported_xenapi of XenAPISession """
"""Stubs out get_imported_xenapi of XenAPISession"""
fake_module = 'nova.virt.xenapi.fake'
from_list = ['fake']
return __import__(fake_module, globals(), locals(), from_list, -1)
@ -34,6 +35,14 @@ def stubout_session(stubs, cls):
fake_import)
def stub_out_get_target(stubs):
"""Stubs out _get_target in volume_utils"""
def fake_get_target(volume_id):
return (None, None)
stubs.Set(volume_utils, '_get_target', fake_get_target)
class FakeSessionForVMTests(fake.SessionBase):
""" Stubs out a XenAPISession for VM tests """
def __init__(self, uri):