def testGetOvaInfo(self): ret = v2v.get_ova_info("dummy") vm = ret['vmList'] self.assertEquals(vm['vmName'], 'First') self.assertEquals(vm['memSize'], 2048) self.assertEquals(vm['smp'], 1) disk = vm['disks'][0] self.assertEquals(disk['allocation'], '349405696') self.assertEquals(disk['capacity'], '34359738368') self.assertEquals(disk['type'], 'disk') self.assertEquals(disk['alias'], 'First-disk1.vmdk') network = vm['networks'][0] self.assertEquals(network['bridge'], 'VM Network') self.assertEquals(network['model'], 'E1000') self.assertEquals(network['type'], 'bridge') self.assertEquals(network['dev'], 'Ethernet 1')
def test_zip(self): with self.temporary_ovf_dir() as (base, ovfpath, ovapath): with zipfile.ZipFile(ovapath, 'w') as zip: zip.write(ovfpath) vm = v2v.get_ova_info(ovapath) self.check(vm['vmList'])
def test_tar(self): with self.temporary_ovf_dir() as (base, ovfpath, ovapath): with tarfile.open(ovapath, 'w') as tar: tar.add(ovfpath, arcname='testvm.ovf') vm = v2v.get_ova_info(ovapath) self.check(vm['vmList'])
def test_directory(self): with self.temporary_ovf_dir() as (base, ovfpath, ovapath): vm = v2v.get_ova_info(base) self.check(vm['vmList'])