@@ -651,6 +651,12 @@ def test_007_run_service_with_gui(self):
651651 self .assertAllCalled ()
652652
653653 def test_008_dispvm_remote (self ):
654+ self .app .expected_calls [
655+ ("dom0" , "admin.vm.CreateDisposable" , None , None )
656+ ] = b"0\x00 disp123"
657+ self .app .expected_calls [
658+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
659+ ] = b"0\x00 default=yes type=int 30"
654660 self .app .expected_calls [
655661 ("dom0" , "admin.property.Get" , "default_dispvm" , None )
656662 ] = b"0\x00 default=True type=vm default-dvm"
@@ -668,20 +674,27 @@ def test_008_dispvm_remote(self):
668674 self .app .service_calls ,
669675 [
670676 (
671- "$dispvm " ,
677+ "disp123 " ,
672678 "test.service" ,
673679 {
674680 "stdout" : subprocess .DEVNULL ,
675681 "stderr" : subprocess .DEVNULL ,
676682 "user" : None ,
683+ "connect_timeout" : 30 ,
677684 },
678685 ),
679- ("$dispvm " , "test.service" , b"" ),
686+ ("disp123 " , "test.service" , b"" ),
680687 ],
681688 )
682689 self .assertAllCalled ()
683690
684691 def test_009_dispvm_remote_specific (self ):
692+ self .app .expected_calls [
693+ ("test-vm" , "admin.vm.CreateDisposable" , None , None )
694+ ] = b"0\x00 disp123"
695+ self .app .expected_calls [
696+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
697+ ] = b"0\x00 default=yes type=int 30"
685698 self .app .expected_calls [("dom0" , "admin.vm.List" , None , None )] = (
686699 b"0\x00 test-vm class=AppVM state=Running\n "
687700 )
@@ -699,15 +712,16 @@ def test_009_dispvm_remote_specific(self):
699712 self .app .service_calls ,
700713 [
701714 (
702- "$dispvm:test-vm " ,
715+ "disp123 " ,
703716 "test.service" ,
704717 {
705718 "stdout" : subprocess .DEVNULL ,
706719 "stderr" : subprocess .DEVNULL ,
707720 "user" : None ,
721+ "connect_timeout" : 30 ,
708722 },
709723 ),
710- ("$dispvm:test-vm " , "test.service" , b"" ),
724+ ("disp123 " , "test.service" , b"" ),
711725 ],
712726 )
713727 self .assertAllCalled ()
@@ -1149,13 +1163,14 @@ def test_022_no_shell(self):
11491163
11501164 def test_023_dispvm_no_shell (self ):
11511165 self .app .expected_calls [
1152- (
1153- "$dispvm:test-vm" ,
1154- "admin.vm.feature.CheckWithTemplate" ,
1155- "vmexec" ,
1156- None ,
1157- )
1166+ ("test-vm" , "admin.vm.CreateDisposable" , None , None )
1167+ ] = b"0\x00 disp123"
1168+ self .app .expected_calls [
1169+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
11581170 ] = b"0\x00 1"
1171+ self .app .expected_calls [
1172+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1173+ ] = b"0\x00 default=yes type=int 30"
11591174 ret = qubesadmin .tools .qvm_run .main (
11601175 ["--no-gui" , "--no-shell" , "--dispvm=test-vm" , "command" ],
11611176 app = self .app ,
@@ -1165,15 +1180,16 @@ def test_023_dispvm_no_shell(self):
11651180 self .app .service_calls ,
11661181 [
11671182 (
1168- "$dispvm:test-vm " ,
1183+ "disp123 " ,
11691184 "qubes.VMExec+command" ,
11701185 {
11711186 "stdout" : subprocess .DEVNULL ,
11721187 "stderr" : subprocess .DEVNULL ,
11731188 "user" : None ,
1189+ "connect_timeout" : 30 ,
11741190 },
11751191 ),
1176- ("$dispvm:test-vm " , "qubes.VMExec+command" , b"" ),
1192+ ("disp123 " , "qubes.VMExec+command" , b"" ),
11771193 ],
11781194 )
11791195 self .assertAllCalled ()
@@ -1276,13 +1292,14 @@ def test_026_no_shell_double_dashdash(self):
12761292
12771293 def test_027_no_shell_dispvm (self ):
12781294 self .app .expected_calls [
1279- (
1280- "$dispvm:test-vm" ,
1281- "admin.vm.feature.CheckWithTemplate" ,
1282- "vmexec" ,
1283- None ,
1284- )
1295+ ("test-vm" , "admin.vm.CreateDisposable" , None , None )
1296+ ] = b"0\x00 disp123"
1297+ self .app .expected_calls [
1298+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
12851299 ] = b"0\x00 1"
1300+ self .app .expected_calls [
1301+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1302+ ] = b"0\x00 default=yes type=int 30"
12861303 ret = qubesadmin .tools .qvm_run .main (
12871304 ["--no-gui" , "--dispvm=test-vm" , "command" , "--" , "arg" ],
12881305 app = self .app ,
@@ -1292,28 +1309,30 @@ def test_027_no_shell_dispvm(self):
12921309 self .app .service_calls ,
12931310 [
12941311 (
1295- "$dispvm:test-vm " ,
1312+ "disp123 " ,
12961313 "qubes.VMExec+command+arg" ,
12971314 {
12981315 "stdout" : subprocess .DEVNULL ,
12991316 "stderr" : subprocess .DEVNULL ,
13001317 "user" : None ,
1318+ "connect_timeout" : 30 ,
13011319 },
13021320 ),
1303- ("$dispvm:test-vm " , "qubes.VMExec+command+arg" , b"" ),
1321+ ("disp123 " , "qubes.VMExec+command+arg" , b"" ),
13041322 ],
13051323 )
13061324 self .assertAllCalled ()
13071325
13081326 def test_028_argparse_bug_workaround (self ):
13091327 self .app .expected_calls [
1310- (
1311- "$dispvm:test-vm" ,
1312- "admin.vm.feature.CheckWithTemplate" ,
1313- "vmexec" ,
1314- None ,
1315- )
1328+ ("test-vm" , "admin.vm.CreateDisposable" , None , None )
1329+ ] = b"0\x00 disp123"
1330+ self .app .expected_calls [
1331+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
13161332 ] = b"0\x00 1"
1333+ self .app .expected_calls [
1334+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1335+ ] = b"0\x00 default=yes type=int 30"
13171336 ret = qubesadmin .tools .qvm_run .main (
13181337 ["--no-gui" , "--dispvm=test-vm" , "command" , "--" , "--" ],
13191338 app = self .app ,
@@ -1323,28 +1342,30 @@ def test_028_argparse_bug_workaround(self):
13231342 self .app .service_calls ,
13241343 [
13251344 (
1326- "$dispvm:test-vm " ,
1345+ "disp123 " ,
13271346 "qubes.VMExec+command+----" ,
13281347 {
13291348 "stdout" : subprocess .DEVNULL ,
13301349 "stderr" : subprocess .DEVNULL ,
13311350 "user" : None ,
1351+ "connect_timeout" : 30 ,
13321352 },
13331353 ),
1334- ("$dispvm:test-vm " , "qubes.VMExec+command+----" , b"" ),
1354+ ("disp123 " , "qubes.VMExec+command+----" , b"" ),
13351355 ],
13361356 )
13371357 self .assertAllCalled ()
13381358
13391359 def test_029_command_is_dashdash (self ):
13401360 self .app .expected_calls [
1341- (
1342- "$dispvm:test-vm" ,
1343- "admin.vm.feature.CheckWithTemplate" ,
1344- "vmexec" ,
1345- None ,
1346- )
1361+ ("test-vm" , "admin.vm.CreateDisposable" , None , None )
1362+ ] = b"0\x00 disp123"
1363+ self .app .expected_calls [
1364+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
13471365 ] = b"0\x00 1"
1366+ self .app .expected_calls [
1367+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1368+ ] = b"0\x00 default=yes type=int 30"
13481369 ret = qubesadmin .tools .qvm_run .main (
13491370 ["--no-gui" , "--dispvm=test-vm" , "--no-shell" , "--" , "--" ],
13501371 app = self .app ,
@@ -1354,23 +1375,30 @@ def test_029_command_is_dashdash(self):
13541375 self .app .service_calls ,
13551376 [
13561377 (
1357- "$dispvm:test-vm " ,
1378+ "disp123 " ,
13581379 "qubes.VMExec+----" ,
13591380 {
13601381 "stdout" : subprocess .DEVNULL ,
13611382 "stderr" : subprocess .DEVNULL ,
13621383 "user" : None ,
1384+ "connect_timeout" : 30 ,
13631385 },
13641386 ),
1365- ("$dispvm:test-vm " , "qubes.VMExec+----" , b"" ),
1387+ ("disp123 " , "qubes.VMExec+----" , b"" ),
13661388 ],
13671389 )
13681390 self .assertAllCalled ()
13691391
13701392 def test_030_no_shell_dispvm (self ):
13711393 self .app .expected_calls [
1372- ("$dispvm" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
1394+ ("dom0" , "admin.vm.CreateDisposable" , None , None )
1395+ ] = b"0\x00 disp123"
1396+ self .app .expected_calls [
1397+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
13731398 ] = b"0\x00 1"
1399+ self .app .expected_calls [
1400+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1401+ ] = b"0\x00 default=yes type=int 30"
13741402 ret = qubesadmin .tools .qvm_run .main (
13751403 ["--no-gui" , "--dispvm" , "--" , "test-vm" , "command" , "arg" ],
13761404 app = self .app ,
@@ -1380,23 +1408,30 @@ def test_030_no_shell_dispvm(self):
13801408 self .app .service_calls ,
13811409 [
13821410 (
1383- "$dispvm " ,
1411+ "disp123 " ,
13841412 "qubes.VMExec+test--vm+command+arg" ,
13851413 {
13861414 "stdout" : subprocess .DEVNULL ,
13871415 "stderr" : subprocess .DEVNULL ,
13881416 "user" : None ,
1417+ "connect_timeout" : 30 ,
13891418 },
13901419 ),
1391- ("$dispvm " , "qubes.VMExec+test--vm+command+arg" , b"" ),
1420+ ("disp123 " , "qubes.VMExec+test--vm+command+arg" , b"" ),
13921421 ],
13931422 )
13941423 self .assertAllCalled ()
13951424
13961425 def test_031_argparse_bug_workaround (self ):
13971426 self .app .expected_calls [
1398- ("$dispvm" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
1427+ ("dom0" , "admin.vm.CreateDisposable" , None , None )
1428+ ] = b"0\x00 disp123"
1429+ self .app .expected_calls [
1430+ ("disp123" , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
13991431 ] = b"0\x00 1"
1432+ self .app .expected_calls [
1433+ ("disp123" , "admin.vm.property.Get" , "qrexec_timeout" , None )
1434+ ] = b"0\x00 default=yes type=int 30"
14001435 ret = qubesadmin .tools .qvm_run .main (
14011436 ["--no-gui" , "--dispvm" , "--" , "test-vm" , "command" , "--" ],
14021437 app = self .app ,
@@ -1406,23 +1441,24 @@ def test_031_argparse_bug_workaround(self):
14061441 self .app .service_calls ,
14071442 [
14081443 (
1409- "$dispvm " ,
1444+ "disp123 " ,
14101445 "qubes.VMExec+test--vm+command+----" ,
14111446 {
1447+ "user" : None ,
14121448 "stdout" : subprocess .DEVNULL ,
14131449 "stderr" : subprocess .DEVNULL ,
1414- "user " : None ,
1450+ "connect_timeout " : 30 ,
14151451 },
14161452 ),
1417- ("$dispvm " , "qubes.VMExec+test--vm+command+----" , b"" ),
1453+ ("disp123 " , "qubes.VMExec+test--vm+command+----" , b"" ),
14181454 ],
14191455 )
14201456 self .assertAllCalled ()
14211457
14221458 @unittest .expectedFailure
14231459 def test_032_argparse_bug_workaround_unnamed_dispvm (self ):
14241460 self .app .expected_calls [
1425- ("$dispvm " , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
1461+ ("disp123 " , "admin.vm.feature.CheckWithTemplate" , "vmexec" , None )
14261462 ] = b"0\x00 1"
14271463 ret = qubesadmin .tools .qvm_run .main (
14281464 ["--no-gui" , "--dispvm" , "test-vm" , "command" , "--" ], app = self .app
@@ -1432,15 +1468,15 @@ def test_032_argparse_bug_workaround_unnamed_dispvm(self):
14321468 self .app .service_calls ,
14331469 [
14341470 (
1435- "$dispvm " ,
1471+ "disp123 " ,
14361472 "qubes.VMExec+test--vm+command+----" ,
14371473 {
14381474 "stdout" : subprocess .DEVNULL ,
14391475 "stderr" : subprocess .DEVNULL ,
14401476 "user" : None ,
14411477 },
14421478 ),
1443- ("$dispvm " , "qubes.VMExec+test--vm+command+----" , b"" ),
1479+ ("disp123 " , "qubes.VMExec+test--vm+command+----" , b"" ),
14441480 ],
14451481 )
14461482 self .assertAllCalled ()
0 commit comments