mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-03-14 12:43:01 +01:00
fix(device-manager-display-widget): fix error message popup on cancelling upload
This commit is contained in:
@@ -20,10 +20,13 @@ def progress_bar(qtbot, mocked_client):
|
||||
def test_progress_bar_initialization(progress_bar):
|
||||
"""Test the initial state of the DeviceInitializationProgressBar."""
|
||||
assert progress_bar.failed_devices == []
|
||||
assert progress_bar._user_value == 0
|
||||
assert progress_bar._user_maximum == 1
|
||||
assert progress_bar.progress_bar._user_value == 0
|
||||
assert progress_bar.progress_bar._user_maximum == 100
|
||||
assert progress_bar.toolTip() == "No device initialization failures."
|
||||
|
||||
assert progress_bar.progress_label.text() == "Initializing devices..."
|
||||
assert progress_bar.group_box.title() == "Config Update Progress"
|
||||
|
||||
|
||||
def test_update_device_initialization_progress(progress_bar, qtbot):
|
||||
"""Test updating the progress bar with different device initialization messages."""
|
||||
@@ -34,22 +37,19 @@ def test_update_device_initialization_progress(progress_bar, qtbot):
|
||||
)
|
||||
|
||||
progress_bar._update_device_initialization_progress(msg.model_dump(), {})
|
||||
assert progress_bar._user_value == 1
|
||||
assert progress_bar._user_maximum == 3
|
||||
assert (
|
||||
f"Device initialization for '{msg.device}' is in progress..."
|
||||
in progress_bar.center_label.text()
|
||||
)
|
||||
assert progress_bar.progress_bar._user_value == 1
|
||||
assert progress_bar.progress_bar._user_maximum == 3
|
||||
assert progress_bar.progress_label.text() == f"{msg.device} initialization in progress..."
|
||||
assert "1 / 3 - 33 %" == progress_bar.progress_bar.center_label.text()
|
||||
|
||||
# II. Update with message of finished DeviceInitializationProgressMessage, finished=True, success=True
|
||||
msg.finished = True
|
||||
msg.success = True
|
||||
progress_bar._update_device_initialization_progress(msg.model_dump(), {})
|
||||
assert progress_bar._user_value == 1
|
||||
assert progress_bar._user_maximum == 3
|
||||
assert (
|
||||
f"Device initialization for '{msg.device}' succeeded!" in progress_bar.center_label.text()
|
||||
)
|
||||
assert progress_bar.progress_bar._user_value == 1
|
||||
assert progress_bar.progress_bar._user_maximum == 3
|
||||
assert progress_bar.progress_label.text() == f"{msg.device} initialization succeeded!"
|
||||
assert "1 / 3 - 33 %" == progress_bar.progress_bar.center_label.text()
|
||||
|
||||
# III. Update with message of finished DeviceInitializationProgressMessage, finished=True, success=False
|
||||
msg.finished = True
|
||||
@@ -58,11 +58,11 @@ def test_update_device_initialization_progress(progress_bar, qtbot):
|
||||
msg.index = 2
|
||||
with qtbot.waitSignal(progress_bar.failed_devices_changed) as signal_blocker:
|
||||
progress_bar._update_device_initialization_progress(msg.model_dump(), {})
|
||||
assert progress_bar._user_value == 2
|
||||
assert progress_bar._user_maximum == 3
|
||||
assert (
|
||||
f"Device initialization for '{msg.device}' failed!" in progress_bar.center_label.text()
|
||||
)
|
||||
assert progress_bar.progress_label.text() == f"{msg.device} initialization failed!"
|
||||
assert "2 / 3 - 66 %" == progress_bar.progress_bar.center_label.text()
|
||||
assert progress_bar.progress_bar._user_value == 2
|
||||
assert progress_bar.progress_bar._user_maximum == 3
|
||||
|
||||
assert signal_blocker.args == [[msg.device]]
|
||||
|
||||
assert progress_bar.toolTip() == f"Failed devices: {msg.device}"
|
||||
|
||||
Reference in New Issue
Block a user