tests: basic tests for admin.vm.volume.Import

This commit is contained in:
Marek Marczykowski-Górecki 2017-05-23 23:28:58 +02:00
parent d7af67d875
commit 3177fc504f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1574,6 +1574,20 @@ class TC_00_VMs(AdminAPITestCase):
self.assertFalse(mock_remove.called)
self.assertFalse(self.app.save.called)
def test_510_vm_volume_import(self):
value = self.call_mgmt_func(b'admin.vm.volume.Import', b'test-vm1',
b'private')
self.assertEqual(value, '{} {}'.format(
2*2**30, '/tmp/qubes-test-dir/appvms/test-vm1/private.img'))
self.assertFalse(self.app.save.called)
def test_511_vm_volume_import_running(self):
with unittest.mock.patch.object(
self.vm, 'get_power_state', lambda: 'Running'):
with self.assertRaises(qubes.exc.QubesVMNotHaltedError):
self.call_mgmt_func(b'admin.vm.volume.Import', b'test-vm1',
b'private')
def test_990_vm_unexpected_payload(self):
methods_with_no_payload = [
b'admin.vm.List',