def test_find_image_in_cache_shares(self): drv = self._driver mox = self.mox drv._mounted_shares = ['testshare'] mox.StubOutWithMock(drv, '_get_mount_point_for_share') mox.StubOutWithMock(os.path, 'exists') drv._get_mount_point_for_share('testshare').AndReturn('/mnt') os.path.exists('/mnt/img-cache-id').AndReturn(True) mox.ReplayAll() result = drv._find_image_in_cache('id') (share, file_name) = result[0] mox.VerifyAll() drv._mounted_shares.remove('testshare') if (share == 'testshare' and file_name == 'img-cache-id'): pass else: LOG.warn( _("Share %(share)s and file name %(file_name)s") % { 'share': share, 'file_name': file_name }) self.fail('Return result is unexpected')
def test_single_vhd_file_chain(self): mox = self.mox mox.StubOutWithMock(image_utils, 'set_vhd_parent') mox.ReplayAll() image_utils.fix_vhd_chain(['0.vhd'])
def test_empty_chain(self): mox = self.mox mox.StubOutWithMock(image_utils, 'set_vhd_parent') mox.ReplayAll() image_utils.fix_vhd_chain([])