mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 19:21:50 +02:00
fix(queue_reset_button): queue reset has to be confirmed with msgBox
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
# pylint: disable=missing-function-docstring, missing-module-docstring, unused-import
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from qtpy.QtWidgets import QMessageBox
|
||||
|
||||
from bec_widgets.widgets.button_reset.button_reset import ResetButton
|
||||
|
||||
@ -15,12 +18,23 @@ def reset_button(qtbot, mocked_client):
|
||||
yield widget
|
||||
|
||||
|
||||
def test_stop_button(reset_button):
|
||||
def test_reset_button_appearance(reset_button):
|
||||
assert reset_button.button.text() == "Reset Queue"
|
||||
assert (
|
||||
reset_button.button.styleSheet()
|
||||
== "background-color: #F19E39; color: white; font-weight: bold; font-size: 12px;"
|
||||
)
|
||||
|
||||
|
||||
@patch.object(QMessageBox, "exec_", return_value=QMessageBox.Yes)
|
||||
def test_reset_button_confirmed(mock_exec, reset_button):
|
||||
reset_button.button.click()
|
||||
assert reset_button.queue.request_queue_reset.called
|
||||
reset_button.close()
|
||||
|
||||
|
||||
@patch.object(QMessageBox, "exec_", return_value=QMessageBox.No)
|
||||
def test_reset_button_cancelled(mock_exec, reset_button):
|
||||
reset_button.button.click()
|
||||
assert not reset_button.queue.request_queue_reset.called
|
||||
reset_button.close()
|
||||
|
Reference in New Issue
Block a user