2017-04-28 02:10:00 +02:00
|
|
|
# -*- encoding: utf8 -*-
|
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2017 Marek Marczykowski-Górecki
|
|
|
|
# <marmarek@invisiblethingslab.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
2017-08-14 09:43:18 +02:00
|
|
|
import os
|
|
|
|
import tempfile
|
2018-10-22 00:33:37 +02:00
|
|
|
import unittest.mock
|
|
|
|
import subprocess
|
2017-08-14 09:43:18 +02:00
|
|
|
|
2017-05-11 23:21:04 +02:00
|
|
|
import qubesadmin.tests
|
|
|
|
import qubesadmin.tests.tools
|
|
|
|
import qubesadmin.tools.qvm_create
|
2017-04-28 02:10:00 +02:00
|
|
|
|
|
|
|
|
2017-05-11 23:21:04 +02:00
|
|
|
class TC_00_qvm_create(qubesadmin.tests.QubesTestCase):
|
2017-04-28 02:10:00 +02:00
|
|
|
def test_000_just_appvm(self):
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.AppVM', None,
|
2017-04-28 02:10:00 +02:00
|
|
|
b'name=new-vm label=red')] = b'0\x00'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00red\nblue\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00new-vm class=AppVM state=Halted\n'
|
2017-05-11 23:21:04 +02:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', 'new-vm'], app=self.app)
|
2017-04-28 02:10:00 +02:00
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_001_missing_vm(self):
|
|
|
|
with self.assertRaises(SystemExit):
|
2017-05-11 23:21:04 +02:00
|
|
|
with qubesadmin.tests.tools.StderrBuffer() as stderr:
|
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red'], app=self.app)
|
2017-04-28 02:10:00 +02:00
|
|
|
self.assertIn('NAME', stderr.getvalue())
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_002_custom_template(self):
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.AppVM',
|
2017-04-28 02:10:00 +02:00
|
|
|
'some-template', b'name=new-vm label=red')] = b'0\x00'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00red\nblue\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00new-vm class=AppVM state=Halted\n'
|
2017-05-11 23:21:04 +02:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-t',
|
2017-04-28 02:10:00 +02:00
|
|
|
'some-template', 'new-vm'], app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_003_properties(self):
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.AppVM',
|
2017-04-28 02:10:00 +02:00
|
|
|
None, b'name=new-vm label=red')] = b'0\x00'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00red\nblue\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00new-vm class=AppVM state=Halted\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('new-vm', 'admin.vm.property.Set',
|
2017-04-28 02:10:00 +02:00
|
|
|
'netvm', b'sys-whonix')] = b'0\x00'
|
2017-05-11 23:21:04 +02:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '--prop',
|
2017-04-28 02:10:00 +02:00
|
|
|
'netvm=sys-whonix', 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_004_pool(self):
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.CreateInPool.AppVM',
|
2017-04-28 02:10:00 +02:00
|
|
|
None, b'name=new-vm label=red pool=some-pool')] = b'0\x00'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00red\nblue\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00new-vm class=AppVM state=Halted\n'
|
2017-05-11 23:21:04 +02:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-P', 'some-pool',
|
2017-04-28 02:10:00 +02:00
|
|
|
'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_005_pools(self):
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.CreateInPool.AppVM',
|
2017-04-28 02:10:00 +02:00
|
|
|
None, b'name=new-vm label=red pool:private=some-pool '
|
|
|
|
b'pool:volatile=other-pool')] = b'0\x00'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00red\nblue\n'
|
2017-05-12 19:36:03 +02:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
2017-04-28 02:10:00 +02:00
|
|
|
b'0\x00new-vm class=AppVM state=Halted\n'
|
2017-05-11 23:21:04 +02:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '--pool',
|
2017-04-28 02:10:00 +02:00
|
|
|
'private=some-pool', '--pool', 'volatile=other-pool', 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
2017-08-14 09:43:18 +02:00
|
|
|
|
|
|
|
def test_005_root_copy_from(self):
|
|
|
|
with tempfile.NamedTemporaryFile() as root_file:
|
|
|
|
root_file.file.write(b'root data')
|
|
|
|
root_file.file.flush()
|
2018-12-08 00:01:02 +01:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
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=AppVM state=Halted\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.List', None, None)] = \
|
|
|
|
b'0\x00root\nprivate\nvolatile\nkernel\n'
|
2018-09-05 04:29:36 +02:00
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'root', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-root\n' \
|
|
|
|
b'size=10000000\n'
|
2017-08-14 09:43:18 +02:00
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Import', 'root', b'root data')] = \
|
|
|
|
b'0\0'
|
2018-12-08 00:01:02 +01:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-C', 'StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
'--root-copy-from=' + root_file.name, 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
self.assertTrue(os.path.exists(root_file.name))
|
|
|
|
|
|
|
|
def test_006_root_move_from(self):
|
|
|
|
with tempfile.NamedTemporaryFile(delete=False) as root_file:
|
|
|
|
root_file.file.write(b'root data')
|
|
|
|
root_file.file.flush()
|
2018-12-08 00:01:02 +01:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
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=AppVM state=Halted\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.List', None, None)] = \
|
|
|
|
b'0\x00root\nprivate\nvolatile\nkernel\n'
|
2018-09-05 04:29:36 +02:00
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'root', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-root\n' \
|
|
|
|
b'size=20000000\n'
|
2017-08-14 09:43:18 +02:00
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Import', 'root', b'root data')] = \
|
|
|
|
b'0\0'
|
2018-12-08 00:01:02 +01:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-C', 'StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
'--root-move-from=' + root_file.name, 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
self.assertFalse(os.path.exists(root_file.name))
|
|
|
|
|
|
|
|
def test_007_root_move_copy_both(self):
|
|
|
|
with tempfile.NamedTemporaryFile() as root_file:
|
|
|
|
root_file.file.write(b'root data')
|
|
|
|
root_file.file.flush()
|
|
|
|
with self.assertRaises(SystemExit):
|
2018-12-08 00:01:02 +01:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-C', 'StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
'--root-copy-from=' + root_file.name,
|
|
|
|
'--root-move-from=' + root_file.name,
|
|
|
|
'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
self.assertTrue(os.path.exists(root_file.name))
|
|
|
|
|
|
|
|
def test_008_root_invalid_path(self):
|
|
|
|
with self.assertRaises(SystemExit):
|
2018-12-08 00:01:02 +01:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-C', 'StandaloneVM',
|
2017-08-14 09:43:18 +02:00
|
|
|
'--root-copy-from=/invalid', 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
2017-08-14 10:14:07 +02:00
|
|
|
|
|
|
|
def test_009_help_classes(self):
|
|
|
|
self.app.expected_calls[('dom0', 'admin.vmclass.List',
|
|
|
|
None, None)] = b'0\x00StandaloneVM\nAppVM\nTemplateVM\nDispVM\n'
|
|
|
|
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
|
|
|
|
qubesadmin.tools.qvm_create.main(['--help-classes'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertEqual(stdout.getvalue(),
|
|
|
|
'AppVM\nDispVM\nStandaloneVM\nTemplateVM\n')
|
|
|
|
self.assertAllCalled()
|
2018-09-05 04:29:36 +02:00
|
|
|
|
|
|
|
def test_010_root_copy_from_with_resize(self):
|
|
|
|
with tempfile.NamedTemporaryFile() as root_file:
|
|
|
|
root_file.file.write(b'root data')
|
|
|
|
root_file.file.flush()
|
2018-12-08 00:01:02 +01:00
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM',
|
2018-09-05 04:29:36 +02:00
|
|
|
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=AppVM state=Halted\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.List', None, None)] = \
|
|
|
|
b'0\x00root\nprivate\nvolatile\nkernel\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'root', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-root\n' \
|
|
|
|
b'size=2\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Resize', 'root', b'9')] = \
|
|
|
|
b'0\0'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Import', 'root', b'root data')] = \
|
|
|
|
b'0\0'
|
2018-12-08 00:01:02 +01:00
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red', '-C', 'StandaloneVM',
|
2018-09-05 04:29:36 +02:00
|
|
|
'--root-copy-from=' + root_file.name, 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertAllCalled()
|
|
|
|
self.assertTrue(os.path.exists(root_file.name))
|
|
|
|
|
2018-10-22 00:33:37 +02:00
|
|
|
@unittest.mock.patch('subprocess.check_output')
|
|
|
|
def test_011_standalonevm(self, check_output_mock):
|
2018-10-18 02:52:10 +02:00
|
|
|
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\x00template class=TemplateVM state=Halted\n' \
|
|
|
|
b'new-vm class=StandaloneVM state=Halted\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.Get', 'label', None)] = \
|
|
|
|
b'0\x00default=False type=label blue'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.Get', 'vcpus', None)] = \
|
|
|
|
b'0\x00default=False type=int 2'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.Get', 'kernel', None)] = \
|
|
|
|
b'0\x00default=True type=str kernel-version'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.Get', 'memory', None)] = \
|
|
|
|
b'0\x00default=True type=int 400'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.Get', 'template', None)] = \
|
|
|
|
b'2\x00QubesNoSuchPropertyError\x00\x00No such property\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.property.List', None, None)] = \
|
|
|
|
b'0\x00name\n' \
|
|
|
|
b'label\n' \
|
|
|
|
b'vcpus\n' \
|
|
|
|
b'kernel\n' \
|
|
|
|
b'memory\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.tag.List', None, None)] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.feature.List', None, None)] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.firewall.Get', None, None)] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM', None,
|
|
|
|
b'name=new-vm label=blue')] = b'0\x00'
|
|
|
|
# TODO this is weird...
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.property.Set', 'label', b'red')] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.property.Set', 'vcpus', b'2')] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.firewall.Set', None, b'')] = \
|
|
|
|
b'0\x00'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.volume.List', None, None)] = \
|
|
|
|
b'0\x00root\nprivate\nvolatile\nkernel\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.List', None, None)] = \
|
|
|
|
b'0\x00root\nprivate\nvolatile\nkernel\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'root', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'snap_on_start=False\n' \
|
|
|
|
b'save_on_stop=True\n' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-root\n' \
|
|
|
|
b'rw=True\n' \
|
|
|
|
b'size=2\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'private', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'snap_on_start=False\n' \
|
|
|
|
b'save_on_stop=True\n' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-private\n' \
|
|
|
|
b'rw=True\n' \
|
|
|
|
b'size=2\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'volatile', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'snap_on_start=False\n' \
|
|
|
|
b'save_on_stop=False\n' \
|
|
|
|
b'pool=other-pool\n' \
|
|
|
|
b'vid=new-vm-volatile\n' \
|
|
|
|
b'rw=True\n' \
|
|
|
|
b'size=2\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.Info', 'kernel', None)] = \
|
|
|
|
b'0\x00' \
|
|
|
|
b'snap_on_start=False\n' \
|
|
|
|
b'save_on_stop=False\n' \
|
|
|
|
b'pool=linux-kernel\n' \
|
|
|
|
b'vid=kernel-version\n' \
|
|
|
|
b'rw=False\n' \
|
|
|
|
b'size=2\n'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('template', 'admin.vm.volume.CloneFrom', 'root', None)] = \
|
|
|
|
b'0\0clone-cookie'
|
|
|
|
self.app.expected_calls[
|
|
|
|
('new-vm', 'admin.vm.volume.CloneTo', 'root', b'clone-cookie')] = \
|
|
|
|
b'0\0'
|
|
|
|
qubesadmin.tools.qvm_create.main(['-C', 'StandaloneVM',
|
|
|
|
'-t', 'template', '-l', 'red', 'new-vm'],
|
|
|
|
app=self.app)
|
2018-10-22 00:33:37 +02:00
|
|
|
check_output_mock.assert_called_once_with(
|
|
|
|
['qvm-appmenus', '--init', '--update',
|
|
|
|
'--source', 'template', 'new-vm'],
|
|
|
|
stderr=subprocess.STDOUT)
|
2018-10-18 02:52:10 +02:00
|
|
|
self.assertAllCalled()
|
|
|
|
|
2018-10-18 03:24:24 +02:00
|
|
|
def test_012_invalid_label(self):
|
|
|
|
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
|
|
|
b'0\x00red\nblue\n'
|
|
|
|
with self.assertRaises(SystemExit):
|
|
|
|
with qubesadmin.tests.tools.StderrBuffer() as stderr:
|
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'invalid', 'name'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertIn('red, blue', stderr.getvalue())
|
|
|
|
self.assertAllCalled()
|
2018-12-08 00:01:02 +01:00
|
|
|
|
|
|
|
def test_013_root_copy_from_template_based(self):
|
|
|
|
with tempfile.NamedTemporaryFile() as root_file:
|
|
|
|
root_file.file.write(b'root data')
|
|
|
|
root_file.file.flush()
|
|
|
|
with self.assertRaises(SystemExit):
|
|
|
|
with qubesadmin.tests.tools.StderrBuffer() as stderr:
|
|
|
|
qubesadmin.tools.qvm_create.main(['-l', 'red',
|
|
|
|
'--root-copy-from=' + root_file.name, 'new-vm'],
|
|
|
|
app=self.app)
|
|
|
|
self.assertIn('--root-copy-from', stderr.getvalue())
|
|
|
|
self.assertAllCalled()
|