app: add VM removal support
This commit is contained in:
parent
77a96b8b21
commit
6cbfd74631
@ -94,6 +94,10 @@ class VMCollection(object):
|
||||
self.refresh_cache()
|
||||
return item in self._vm_list
|
||||
|
||||
def __delitem__(self, key):
|
||||
self.app.qubesd_call(key, 'mgmt.vm.Remove')
|
||||
self.clear_cache()
|
||||
|
||||
def __iter__(self):
|
||||
self.refresh_cache()
|
||||
for vm in self._vm_list:
|
||||
|
@ -59,4 +59,10 @@ class TC_00_VMCollection(qubesmgmt.tests.QubesTestCase):
|
||||
self.assertEqual([vm.name for vm in self.app.domains], ['test-vm'])
|
||||
self.assertAllCalled()
|
||||
|
||||
def test_004_delitem(self):
|
||||
self.app.expected_calls[('test-vm', 'mgmt.vm.Remove', None, None)] = \
|
||||
b'0\x00'
|
||||
del self.app.domains['test-vm']
|
||||
self.assertAllCalled()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user