gui: add checks for changing/removing guivm

This commit is contained in:
Frédéric Pierret (fepitre) 2020-03-08 11:54:22 +01:00
parent c36ad38eb3
commit 90584c487a
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -596,18 +596,29 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
holder = MyTestHolder(None)
guivm = self.app.add_new_vm('AppVM', name='sys-gui', guivm='dom0',
template=self.template, label='red')
vncvm = self.app.add_new_vm('AppVM', name='sys-vnc', guivm='dom0',
template=self.template, label='red')
appvm = self.app.add_new_vm('AppVM', name='test-vm', guivm='dom0',
template=self.template, label='red')
holder.guivm = 'sys-gui'
self.assertEqual(holder.guivm, 'sys-gui')
self.assertFalse(appvm.property_is_default('guivm'))
appvm.guivm = guivm
self.assertEventFired(holder, 'property-set:guivm',
kwargs={'name': 'guivm',
'newvalue': 'sys-gui'})
# Set GuiVM
self.assertFalse(appvm.property_is_default('guivm'))
appvm.guivm = guivm
self.assertIn('guivm-sys-gui', appvm.tags)
# Change GuiVM
appvm.guivm = vncvm
self.assertIn('guivm-sys-vnc', appvm.tags)
# Empty GuiVM
del appvm.guivm
self.assertNotIn('guivm-', appvm.tags)
def test_114_default_audiovm(self):
class MyTestHolder(qubes.tests.TestEmitter, qubes.PropertyHolder):
default_audiovm = qubes.property('default_audiovm',