added tests for shortcuts

This commit is contained in:
GammaSQ 2018-12-08 12:38:26 +01:00
parent ce2fb96a4b
commit b848625428
No known key found for this signature in database
GPG Key ID: D552FD2F98647C64

View File

@ -328,3 +328,25 @@ class TC_00_qvm_create(qubesadmin.tests.QubesTestCase):
app=self.app)
self.assertIn('red, blue', stderr.getvalue())
self.assertAllCalled()
def test_014_standalone_shortcut(self):
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM',
None, b'name=new-vm label=red')] = b'0\x00'
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
b'0\x00red\nblue\n'
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
b'0\x00new-vm class=StandaloneVM state=Halted\n'
qubesadmin.tools.qvm_create.main(['-l', 'red', '--standalone', 'new-vm'],
app=self.app)
self.assertAllCalled()
def test_015_disp_shortcut(self):
self.app.expected_calls[('dom0', 'admin.vm.Create.DispVM',
None, b'name=new-vm label=red')] = b'0\x00'
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
b'0\x00red\nblue\n'
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
b'0\x00new-vm class=DispVM state=Halted\n'
qubesadmin.tools.qvm_create.main(['--disp', 'new-vm'],
app=self.app)
self.assertAllCalled()