Skip to content

Commit

Permalink
Fixed broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
canismarko committed Jun 4, 2024
1 parent 92d9a2a commit 0eaaff8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/firefly/tests/test_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
12 changes: 9 additions & 3 deletions src/firefly/tests/test_queue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()


Expand Down

0 comments on commit 0eaaff8

Please sign in to comment.