def test_createVM(self): _toStdMACSyntax = lambda s: \ ':'.join([ s[i:i+2] for i in range(0,len(s),2) ]) for machineName in ('image1', 'image2'): m = VirtualBox._findMachineByNameOrId(machineName) nic0 = m.getNetworkAdapter(0) nic0attachmentType = nic0.attachmentType self.assertEquals( VirtualBox._ctx['ifaces'].NetworkAttachmentType_NAT, nic0attachmentType) nic1 = m.getNetworkAdapter(1) self.assertEquals(VirtualBox.getNamesToIdsMapping().get(machineName), \ _toStdMACSyntax(nic1.MACAddress)) nic1attachmentType = nic1.attachmentType self.assertEquals( VirtualBox._ctx['ifaces'].NetworkAttachmentType_HostOnly, nic1attachmentType) hd = m.getMediumAttachment('SCSI', 0, 0).medium if machineName == 'image1': self.assertSubstring(self.IMAGE1_LOCATION, hd.location) elif machineName == 'image2': self.assertSubstring(self.IMAGE2_LOCATION, hd.location)
def test_createVM(self): _toStdMACSyntax = lambda s: \ ':'.join([ s[i:i+2] for i in range(0,len(s),2) ]) for machineName in ('image1', 'image2'): m = VirtualBox._findMachineByNameOrId(machineName) nic0 = m.getNetworkAdapter(0) nic0attachmentType = nic0.attachmentType self.assertEquals(VirtualBox._ctx['ifaces'].NetworkAttachmentType_NAT, nic0attachmentType) nic1 = m.getNetworkAdapter(1) self.assertEquals(VirtualBox.getNamesToIdsMapping().get(machineName), \ _toStdMACSyntax(nic1.MACAddress)) nic1attachmentType = nic1.attachmentType self.assertEquals(VirtualBox._ctx['ifaces'].NetworkAttachmentType_HostOnly, nic1attachmentType) hd = m.getMediumAttachment('SCSI', 0,0).medium if machineName == 'image1': self.assertSubstring(self.IMAGE1_LOCATION, hd.location) elif machineName == 'image2': self.assertSubstring(self.IMAGE2_LOCATION, hd.location)