@@ -71,8 +71,8 @@ def test_00_load_backup(backup_dlg):
71
71
72
72
73
73
def 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 or item 0)
75
+ assert backup_dlg .compression_combobox . currentIndex () in [ 0 , - 1 ]
76
76
77
77
# passphrase is empty
78
78
assert backup_dlg .passphrase_line_edit .text () == "" , "Password non-empty"
@@ -175,7 +175,10 @@ def test_10_do_backup(mock_open, backup_dlg):
175
175
backup_dlg .passphrase_line_edit_verify .setText ("pass" )
176
176
backup_dlg .save_profile_checkbox .setChecked (False )
177
177
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
+ )
179
182
180
183
expected_call = ('dom0' , 'admin.backup.Info' , 'qubes-manager-backup-tmp' ,
181
184
None )
@@ -233,7 +236,7 @@ def test_20_loading_settings(mock_load, test_qubes_app, qapp):
233
236
"Passphrase not loaded"
234
237
assert backup_dlg .passphrase_line_edit_verify .text () == "longerPassPhrase" \
235
238
, "Passphrase verify not loaded"
236
- assert backup_dlg .compress_checkbox . isChecked ()
239
+ assert backup_dlg .compression_combobox . currentIndex () == 0
237
240
238
241
# check that 'include' vms were not pre-selected
239
242
include_in_backups_no = len (
@@ -247,6 +250,67 @@ def test_20_loading_settings(mock_load, test_qubes_app, qapp):
247
250
assert not backup_dlg .unrecognized_config_label .isVisible ()
248
251
249
252
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
+
250
314
@mock .patch ('qubesmanager.backup_utils.load_backup_profile' )
251
315
def test_21_loading_settings_error (mock_load , test_qubes_app , qapp ):
252
316
mock_load .return_value = {
0 commit comments