@@ -40,9 +40,7 @@ def test_populate_vm_list(
4040 ("test-standalone" , "admin.vm.feature.Get" , "updates-available" , None )
4141 ] = (b"0\x00 " + str (1 ).encode ())
4242 # inconsistent output of qubes-vm-update, but it does not matter
43- mock_subprocess .return_value = (
44- b"Following templates will be updated:test-standalone"
45- )
43+ mock_subprocess .return_value = b"The admin VM will not be updated.\n Following templates will be updated:test-standalone"
4644
4745 assert not sut .is_populated
4846
@@ -56,12 +54,13 @@ def test_populate_vm_list(
5654 ("fedora-36" , "admin.vm.feature.Get" , "updates-available" , None )
5755 ] = (b"0\x00 " + str (1 ).encode ())
5856 mock_subprocess .return_value = (
57+ b"The admin VM (dom0) will be updated.\n "
5958 b"Following templates will be updated:test-standalone,fedora-36"
6059 )
6160
6261 sut .populate_vm_list (test_qapp , mock_settings )
6362 assert len (sut .list_store ) == 4
64- assert len (sut .get_vms_to_update ()) == 2
63+ assert len (sut .get_vms_to_update ()) == 3
6564
6665
6766@pytest .mark .parametrize (
@@ -340,35 +339,52 @@ def test_prohibit_start_rationale_tooltip(
340339 # Comma separated list of VMs to target
341340 pytest .param (
342341 ("--targets" , "dom0,fedora-36" ),
343- b"fedora-36" ,
342+ b"dom0, fedora-36" ,
344343 b"" ,
345344 {"dom0" , "fedora-36" },
346- ("--targets" , "fedora-36" ),
345+ ("--targets" , "dom0, fedora-36" ),
347346 id = "targets" ,
348347 ),
349348 # `qubes-update-gui --standalones`
350349 # Target all StandaloneVMs
351350 pytest .param (
352351 ("--standalones" ,),
353- b"" ,
354352 "," .join (_standalones ).encode (),
353+ b"" ,
355354 _standalones ,
356355 ("--standalones" ,),
357356 id = "standalones" ,
358357 ),
359358 # `qubes-update-gui --dom0`
360359 # Target dom0
361360 pytest .param (
362- ("--dom0" , "--force-update" ), b"" , b"" , {"dom0" }, None , id = "dom0"
361+ ("--dom0" , "--force-update" ),
362+ b"" ,
363+ b"" ,
364+ {"dom0" },
365+ ("--force-update" , "--targets" , "dom0" ),
366+ id = "dom0" ,
363367 ),
364368 # `qubes-update-gui --dom0 --skip dom0`
365369 # Comma separated list of VMs to be skipped,
366370 # works with all other options.
367371 pytest .param (
368- ("--dom0" , "--skip" , "dom0" ), b"" , b"" , set (), None , id = "skip all"
372+ ("--dom0" , "--skip" , "dom0" ),
373+ b"" ,
374+ b"" ,
375+ set (),
376+ ("--skip" , "dom0" , "--targets" , "dom0" ),
377+ id = "skip all" ,
369378 ),
370379 # `qubes-update-gui --skip dom0`
371- pytest .param (("--skip" , "dom0" ), b"" , b"" , set (), None , id = "skip dom0" ),
380+ pytest .param (
381+ ("--skip" , "dom0" ),
382+ b"" ,
383+ b"" ,
384+ set (),
385+ ("--skip" , "dom0" ),
386+ id = "skip dom0" ,
387+ ),
372388 # `qubes-update-gui --skip garbage-name`
373389 pytest .param (
374390 ("--skip" , "garbage-name" ),
@@ -385,7 +401,7 @@ def test_prohibit_start_rationale_tooltip(
385401 b"" ,
386402 b"" ,
387403 set (),
388- None ,
404+ ( "--skip" , "dom0" , "--targets" , "dom0" ) ,
389405 id = "skip all targets" ,
390406 ),
391407 # `qubes-update-gui --templates dom0 --skip fedora-36,garbage-name`
@@ -426,7 +442,11 @@ def test_select_rows_ignoring_conditions(
426442
427443 assert len (sut .list_store ) == 12
428444
429- result = b""
445+ if "dom0" in expected_selection :
446+ result = b"The admin VM (dom0) will be updated.\n "
447+ else :
448+ result = b"The admin VM will not be updated.\n "
449+
430450 if tmpls_and_stndas :
431451 result += (
432452 b"Following templates and standalones will be updated: "
@@ -446,7 +466,7 @@ def test_select_rows_ignoring_conditions(
446466 ] = (b"0\x00 " + b"3020-01-01 00:00:00" )
447467
448468 cliargs = parse_args (args , test_qapp )
449- sut .select_rows_ignoring_conditions (cliargs , test_qapp . domains [ "dom0" ] )
469+ sut .select_rows_ignoring_conditions (cliargs )
450470 to_update = {row .name for row in sut .list_store if row .selected }
451471
452472 assert to_update == expected_selection
0 commit comments