@@ -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# i-th expectations value is an expected number of selected VMs after clicking on the
@@ -342,33 +341,46 @@ def test_prohibit_start_rationale_tooltip(
342341 # Comma separated list of VMs to target
343342 pytest .param (
344343 ("--targets" , "dom0,fedora-36" ),
345- b"fedora-36" ,
344+ b"dom0, fedora-36" ,
346345 b"" ,
347346 {"dom0" , "fedora-36" },
348- ("--targets" , "fedora-36" ),
347+ ("--targets" , "dom0, fedora-36" ),
349348 id = "targets" ,
350349 ),
351350 # `qubes-update-gui --standalones`
352351 # Target all StandaloneVMs
353352 pytest .param (
354353 ("--standalones" ,),
355- b"" ,
356354 "," .join (_standalones ).encode (),
355+ b"" ,
357356 _standalones ,
358357 ("--standalones" ,),
359358 id = "standalones" ,
360359 ),
361360 # `qubes-update-gui --dom0`
362361 # Target dom0
363- pytest .param (("--dom0" , "--force-update" ), b"" , b"" , {"dom0" }, None , id = "dom0" ),
362+ pytest .param (("--dom0" , "--force-update" ), b"" , b"" , {"dom0" },
363+ ("--force-update" , "--targets" , "dom0" ), id = "dom0" ),
364364 # `qubes-update-gui --dom0 --skip dom0`
365365 # Comma separated list of VMs to be skipped,
366366 # works with all other options.
367367 pytest .param (
368- ("--dom0" , "--skip" , "dom0" ), b"" , b"" , set (), None , id = "skip all"
368+ ("--dom0" , "--skip" , "dom0" ),
369+ b"" ,
370+ b"" ,
371+ set (),
372+ ("--skip" , "dom0" , "--targets" , "dom0" ),
373+ id = "skip all" ,
369374 ),
370375 # `qubes-update-gui --skip dom0`
371- pytest .param (("--skip" , "dom0" ), b"" , b"" , set (), None , id = "skip dom0" ),
376+ pytest .param (
377+ ("--skip" , "dom0" ),
378+ b"" ,
379+ b"" ,
380+ set (),
381+ ("--skip" , "dom0" ),
382+ id = "skip dom0" ,
383+ ),
372384 # `qubes-update-gui --skip garbage-name`
373385 pytest .param (
374386 ("--skip" , "garbage-name" ),
@@ -385,7 +397,7 @@ def test_prohibit_start_rationale_tooltip(
385397 b"" ,
386398 b"" ,
387399 set (),
388- None ,
400+ ( "--skip" , "dom0" , "--targets" , "dom0" ) ,
389401 id = "skip all targets" ,
390402 ),
391403 # `qubes-update-gui --templates dom0 --skip fedora-36,garbage-name`
@@ -424,7 +436,11 @@ def test_select_rows_ignoring_conditions(
424436
425437 assert len (sut .list_store ) == 13
426438
427- result = b""
439+ if "dom0" in expected_selection :
440+ result = b"The admin VM (dom0) will be updated.\n "
441+ else :
442+ result = b"The admin VM will not be updated.\n "
443+
428444 if tmpls_and_stndas :
429445 result += (
430446 b"Following templates and standalones will be updated: " + tmpls_and_stndas
@@ -443,7 +459,7 @@ def test_select_rows_ignoring_conditions(
443459 ] = (b"0\x00 " + b"3020-01-01 00:00:00" )
444460
445461 cliargs = parse_args (args , test_qapp )
446- sut .select_rows_ignoring_conditions (cliargs , test_qapp . domains [ "dom0" ] )
462+ sut .select_rows_ignoring_conditions (cliargs )
447463 to_update = {row .name for row in sut .list_store if row .selected }
448464
449465 assert to_update == expected_selection
0 commit comments