From 0eaaff87528fd74c8c2f594429a68d8b377f8914 Mon Sep 17 00:00:00 2001 From: Mark Wolfman Date: Tue, 4 Jun 2024 11:48:23 -0500 Subject: [PATCH] Fixed broken tests. --- src/firefly/tests/test_main_window.py | 8 ++++---- src/firefly/tests/test_queue_client.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/firefly/tests/test_main_window.py b/src/firefly/tests/test_main_window.py index 654b1868..50b77445 100644 --- a/src/firefly/tests/test_main_window.py +++ b/src/firefly/tests/test_main_window.py @@ -21,12 +21,12 @@ def test_navbar_autohide(ffapp, qtbot): window.show() navbar = window.ui.navbar # Pretend the queue has some things in it - with qtbot.waitSignal(ffapp.queue_length_changed): - ffapp.queue_length_changed.emit(3) + with qtbot.waitSignal(ffapp.queue_in_use_changed): + ffapp.queue_in_use_changed.emit(True) assert navbar.isVisible() # Make the queue be empty - with qtbot.waitSignal(ffapp.queue_length_changed): - ffapp.queue_length_changed.emit(0) + with qtbot.waitSignal(ffapp.queue_in_use_changed): + ffapp.queue_in_use_changed.emit(False) assert not navbar.isVisible() diff --git a/src/firefly/tests/test_queue_client.py b/src/firefly/tests/test_queue_client.py index e93d0ce4..ddd20179 100644 --- a/src/firefly/tests/test_queue_client.py +++ b/src/firefly/tests/test_queue_client.py @@ -297,6 +297,9 @@ async def test_run_plan(client, qtbot): """Test if a plan can be queued in the queueserver.""" api = client.api api.item_add.return_value = {"success": True, "qsize": 2} + new_status = qs_status.copy() + new_status["items_in_queue"] = 2 + api.status.return_value = new_status # Send a plan with qtbot.waitSignal( client.length_changed, timeout=1000, check_params_cb=lambda l: l == 2 @@ -317,15 +320,18 @@ async def test_toggle_autostart(client, qtbot): api.queue_autostart.assert_called_once_with(True) -def test_autostart_changed(client, ffapp): +def test_autostart_changed(client, ffapp, qtbot): """Does the action respond to changes in the queue autostart status? """ + ffapp.queue_autostart_action.setChecked(True) assert ffapp.queue_autostart_action.isChecked() - client.autostart_changed.emit(False) + with qtbot.waitSignal(client.autostart_changed, timeout=3): + client.autostart_changed.emit(False) assert not ffapp.queue_autostart_action.isChecked() - client.autostart_changed.emit(True) + with qtbot.waitSignal(client.autostart_changed, timeout=3): + client.autostart_changed.emit(True) assert ffapp.queue_autostart_action.isChecked()