mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
test: fix tests for launcher close / hide behavior
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import argparse
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
from bec_lib.service_config import ServiceConfig
|
||||
@ -31,26 +30,3 @@ def test_gui_server_get_service_config(gui_server):
|
||||
Test that the server is started with the correct arguments.
|
||||
"""
|
||||
assert gui_server._get_service_config().config is ServiceConfig().config
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"connections, hide",
|
||||
[
|
||||
({}, False),
|
||||
({"launcher": mock.MagicMock()}, False),
|
||||
({"launcher": mock.MagicMock(), "dock_area": mock.MagicMock()}, True),
|
||||
],
|
||||
)
|
||||
def test_gui_server_turns_off_the_lights(gui_server, connections, hide):
|
||||
with mock.patch.object(gui_server, "launcher_window") as mock_launcher_window:
|
||||
with mock.patch.object(gui_server, "app") as mock_app:
|
||||
gui_server._turn_off_the_lights(connections)
|
||||
|
||||
if not hide:
|
||||
mock_launcher_window.show.assert_called_once()
|
||||
mock_launcher_window.activateWindow.assert_called_once()
|
||||
mock_launcher_window.raise_.assert_called_once()
|
||||
mock_app.setQuitOnLastWindowClosed.assert_called_once_with(True)
|
||||
else:
|
||||
mock_launcher_window.hide.assert_called_once()
|
||||
mock_app.setQuitOnLastWindowClosed.assert_called_once_with(False)
|
||||
|
Reference in New Issue
Block a user