Ejemplo n.º 1
0
 def test_delete_undefine_snapshots(self):
     """QEMU Domain undefine with snapshots metadata."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = False
     qemu.domain_delete(domain, logger)
     domain.undefineFlags.assert_called_with(libvirt.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA)
Ejemplo n.º 2
0
 def test_delete_undefine(self):
     """QEMU Domain is undefined."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = False
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.undefineFlags.called)
Ejemplo n.º 3
0
 def test_delete_destroy(self):
     """QEMU Domain is destroyed if active."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = True
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.destroy.called)
Ejemplo n.º 4
0
 def test_delete_destroy_error(self):
     """QEMU Domain destroy raises error."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = True
     domain.destroy.side_effect = libvirt.libvirtError("BOOM")
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.undefineFlags.called)