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