def test_convert_types(self): vm = VirtualMachine(self.xml, self.client) vm.convert_types() assert vm.name == 'vm-example' assert vm.id == 6 assert vm.last_poll == 1277729095 assert vm.state == 3 assert vm.lcm_state == 3 assert vm.stime == 1277375180 assert vm.etime == 0 assert vm.deploy_id == 'dummy' assert vm.memory == 512 assert vm.cpu == 1 assert vm.net_tx == 12345 assert vm.net_rx == 0 assert isinstance(vm.template, Template)
def test_save_disk(self): self.client.call = Mock(return_value='') vm = VirtualMachine(self.xml, self.client) assert vm.save_disk(1, 2) is None
def test_live_migrate(self): self.client.call = Mock(return_value='') vm = VirtualMachine(self.xml, self.client) assert vm.live_migrate(3) is None
def test_deploy(self): self.client.call = Mock(return_value='') vm = VirtualMachine(self.xml, self.client) assert vm.deploy(3) is None
def test_allocate(self): self.client.call = Mock(return_value=3) assert VirtualMachine.allocate(self.client, '<VM></VM>') == 3
def test_new_with_id(self): vm = VirtualMachine.new_with_id(self.client, 1) assert vm.id == 1
def test_repr(self): vm = VirtualMachine(self.xml, self.client) assert vm.__repr__() == '<oca.VirtualMachine("vm-example")>'