app: add VM removal support

This commit is contained in:
Marek Marczykowski-Górecki 2017-04-21 04:01:37 +02:00
parent 77a96b8b21
commit 6cbfd74631
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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()