Skip to content

Commit 6831449

Browse files
committed
Fix tests
1 parent 1b0f0ee commit 6831449

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

qubes_config/global_config/basics_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def get_current_value(self):
299299
return 0
300300
if not self.is_dvm_template:
301301
return 0
302-
return int(self.qapp.domains["dom0"].features.get("preload-dispvm-max")) or 0
302+
return int(self.qapp.domains["dom0"].features.get("preload-dispvm-max") or 0)
303303

304304
def update_current_value(self):
305305
"""This should never be called."""

qubes_config/tests/test_basics_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ def test_kernels(test_qapp):
339339

340340

341341
def test_basics_handler(real_builder, test_qapp):
342+
test_qapp.expected_calls[
343+
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
344+
] = b"0\x00"
342345
basics_handler = BasicSettingsHandler(real_builder, test_qapp)
343346

344347
assert basics_handler.get_unsaved() == ""
@@ -364,7 +367,4 @@ def test_basics_handler(real_builder, test_qapp):
364367
test_qapp.expected_calls[
365368
("dom0", "admin.property.Set", "clockvm", b"test-blue")
366369
] = b"0\x00"
367-
test_qapp.expected_calls[
368-
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
369-
] = b"0\x00"
370370
basics_handler.save()

qubes_config/tests/test_global_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def test_qubes_global_config():
7575
def test_global_config_init(
7676
mock_error, mock_subprocess, test_qapp, test_policy_manager, test_builder
7777
):
78+
test_qapp.expected_calls[
79+
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
80+
] = b"0\x00"
7881
mock_subprocess.return_value = b""
7982
app = GlobalConfig(test_qapp, test_policy_manager)
8083
# do not call do_activate - it will make Gtk confused and, in case
@@ -140,6 +143,9 @@ def test_global_config_init(
140143
def test_global_config_page_change(
141144
mock_error, mock_subprocess, test_qapp, test_policy_manager, test_builder
142145
):
146+
test_qapp.expected_calls[
147+
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
148+
] = b"0\x00"
143149
mock_subprocess.return_value = b""
144150
app = GlobalConfig(test_qapp, test_policy_manager)
145151
# do not call do_activate - it will make Gtk confused and, in case
@@ -238,6 +244,9 @@ def test_global_config_page_change(
238244
def test_global_config_failure(
239245
mock_error, mock_subprocess, test_qapp, test_policy_manager, test_builder
240246
):
247+
test_qapp.expected_calls[
248+
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
249+
] = b"0\x00"
241250
mock_subprocess.return_value = b""
242251
app = GlobalConfig(test_qapp, test_policy_manager)
243252
# do not call do_activate - it will make Gtk confused and, in case
@@ -302,6 +311,9 @@ def test_global_config_broken_system(
302311
def test_global_config_open_at(
303312
mock_error, mock_subprocess, test_qapp, test_policy_manager, real_builder
304313
):
314+
test_qapp.expected_calls[
315+
("dom0", "admin.vm.feature.Get", "preload-dispvm-max", None)
316+
] = b"0\x00"
305317
mock_subprocess.return_value = b""
306318
app = GlobalConfig(test_qapp, test_policy_manager)
307319
# do not call do_activate - it will make Gtk confused and, in case

0 commit comments

Comments
 (0)