tools/qvm-create: fix handling invalid label
This commit is contained in:
parent
759fafea63
commit
5078d75aa3
@ -312,3 +312,13 @@ class TC_00_qvm_create(qubesadmin.tests.QubesTestCase):
|
||||
app=self.app)
|
||||
self.assertAllCalled()
|
||||
|
||||
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()
|
||||
|
||||
|
@ -129,7 +129,7 @@ def main(args=None, app=None):
|
||||
except KeyError:
|
||||
parser.error('no such label: {!r}; available: {}'.format(
|
||||
args.properties['label'],
|
||||
', '.join(repr(l.name) for l in args.app.labels)))
|
||||
', '.join(args.app.labels)))
|
||||
|
||||
try:
|
||||
args.app.get_vm_class(args.cls)
|
||||
|
Loading…
Reference in New Issue
Block a user