@@ -71,8 +71,8 @@ def test_00_load_backup(backup_dlg):
7171
7272
7373def test_01_correct_default (backup_dlg ):
74- # backup is compressed
75- assert backup_dlg .compress_checkbox . isChecked ()
74+ # backup compresssion is the default (no item selected)
75+ assert backup_dlg .compression_combobox . currentIndex () == - 1
7676
7777 # passphrase is empty
7878 assert backup_dlg .passphrase_line_edit .text () == "" , "Password non-empty"
@@ -175,7 +175,10 @@ def test_10_do_backup(mock_open, backup_dlg):
175175 backup_dlg .passphrase_line_edit_verify .setText ("pass" )
176176 backup_dlg .save_profile_checkbox .setChecked (False )
177177 backup_dlg .turn_off_checkbox .setChecked (False )
178- backup_dlg .compress_checkbox .setChecked (False )
178+ backup_dlg .compression_combobox .addItem ("Disabled (uncompressed" )
179+ backup_dlg .compression_combobox .setCurrentIndex (
180+ backup_dlg .compression_combobox .count () - 1
181+ )
179182
180183 expected_call = ('dom0' , 'admin.backup.Info' , 'qubes-manager-backup-tmp' ,
181184 None )
@@ -233,7 +236,7 @@ def test_20_loading_settings(mock_load, test_qubes_app, qapp):
233236 "Passphrase not loaded"
234237 assert backup_dlg .passphrase_line_edit_verify .text () == "longerPassPhrase" \
235238 , "Passphrase verify not loaded"
236- assert backup_dlg .compress_checkbox . isChecked ()
239+ assert backup_dlg .compression_combobox . currentIndex () == 0
237240
238241 # check that 'include' vms were not pre-selected
239242 include_in_backups_no = len (
@@ -247,6 +250,67 @@ def test_20_loading_settings(mock_load, test_qubes_app, qapp):
247250 assert not backup_dlg .unrecognized_config_label .isVisible ()
248251
249252
253+ @mock .patch ('qubesmanager.backup_utils.load_backup_profile' )
254+ def test_20_loading_settings_nocomp (mock_load , test_qubes_app , qapp ):
255+
256+ mock_load .return_value = {
257+ 'destination_vm' : 'test-blue' ,
258+ 'destination_path' : "/home" ,
259+ 'include' : ['dom0' , 'test-red' , 'sys-net' ],
260+ 'passphrase_text' : "longerPassPhrase" ,
261+ 'compression' : False
262+ }
263+
264+ dispatcher = MockAsyncDispatcher (test_qubes_app )
265+ backup_dlg = backup .BackupVMsWindow (qapp , test_qubes_app , dispatcher )
266+ # needed because otherwise the wizard will not test correctly
267+ backup_dlg .show ()
268+
269+ # check if last compression filter (Disabled) is selected
270+ assert backup_dlg .compression_combobox .currentIndex () == \
271+ backup_dlg .compression_combobox .count () - 1
272+
273+
274+ @mock .patch ('qubesmanager.backup_utils.load_backup_profile' )
275+ def test_20_loading_settings_bzip2 (mock_load , test_qubes_app , qapp ):
276+
277+ mock_load .return_value = {
278+ 'destination_vm' : 'test-blue' ,
279+ 'destination_path' : "/home" ,
280+ 'include' : ['dom0' , 'test-red' , 'sys-net' ],
281+ 'passphrase_text' : "longerPassPhrase" ,
282+ 'compression' : "bzip2"
283+ }
284+
285+ dispatcher = MockAsyncDispatcher (test_qubes_app )
286+ backup_dlg = backup .BackupVMsWindow (qapp , test_qubes_app , dispatcher )
287+ # needed because otherwise the wizard will not test correctly
288+ backup_dlg .show ()
289+
290+ # check if the right compression filter is selected
291+ assert backup_dlg .compression_combobox .currentText () == "bzip2"
292+
293+
294+ @mock .patch ('qubesmanager.backup_utils.load_backup_profile' )
295+ def test_20_loading_settings_pkzip (mock_load , test_qubes_app , qapp ):
296+
297+ mock_load .return_value = {
298+ 'destination_vm' : 'test-blue' ,
299+ 'destination_path' : "/home" ,
300+ 'include' : ['dom0' , 'test-red' , 'sys-net' ],
301+ 'passphrase_text' : "longerPassPhrase" ,
302+ 'compression' : "pkzip"
303+ }
304+
305+ dispatcher = MockAsyncDispatcher (test_qubes_app )
306+ backup_dlg = backup .BackupVMsWindow (qapp , test_qubes_app , dispatcher )
307+ # needed because otherwise the wizard will not test correctly
308+ backup_dlg .show ()
309+
310+ # check if the compression filter reverts to the default
311+ assert backup_dlg .compression_combobox .currentIndex () == 0
312+
313+
250314@mock .patch ('qubesmanager.backup_utils.load_backup_profile' )
251315def test_21_loading_settings_error (mock_load , test_qubes_app , qapp ):
252316 mock_load .return_value = {
0 commit comments