-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix logout problem with multipe flightpath docking widget #2319
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,9 +201,6 @@ def __init__(self, parent=None, mainwindow=None, model=None, _id=None, | |
self.mainwindow_signal_permission_revoked = mainwindow.signal_permission_revoked | ||
self.mainwindow_signal_render_new_permission = mainwindow.signal_render_new_permission | ||
self.mainwindow_signal_activate_flighttrack = mainwindow.signal_activate_flighttrack | ||
self.mainwindow_signal_activate_operation = mainwindow.signal_activate_operation | ||
self.mainwindow_signal_login_mscolab = mainwindow.signal_login_mscolab | ||
self.mainwindow_signal_logout_mscolab = mainwindow.signal_logout_mscolab | ||
self.mainwindow_listFlightTracks = mainwindow.listFlightTracks | ||
self.mainwindow_filterCategoryCb = mainwindow.filterCategoryCb | ||
self.mainwindow_listOperationsMSC = mainwindow.listOperationsMSC | ||
|
@@ -362,7 +359,7 @@ def openTool(self, index): | |
mscolab_server_url=self.mscolab_server_url, | ||
token=self.token) | ||
|
||
self.mainwindow_signal_logout_mscolab.connect(lambda: self.signal_logout_mscolab.emit()) | ||
self.mainwindow_signal_logout_mscolab.connect(self.signal_logout_mscolab.emit) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as discussed in #2310 (commits) this was the culprit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please file an issue to change this type of lambda everywhere? I've seen it in other places as well and the construct is generally problematic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a follow up: #2320 |
||
self.mainwindow_signal_listFlighttrack_doubleClicked.connect( | ||
lambda: self.signal_listFlighttrack_doubleClicked.emit()) | ||
self.mainwindow_signal_permission_revoked.connect( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,74 @@ def assert_logout_text(): | |
qtbot.wait_until(assert_label_text) | ||
# ToDo verify all operations disabled again without a visual check | ||
|
||
def test_multiple_flightpath_switching_to_flighttrack_and_logout(self, qtbot): | ||
""" | ||
checks that we can switch in topviews with the multiple flightpath dockingwidget | ||
between local flight track and operations, and we are able to cycle a login/logout | ||
""" | ||
# more operations for the user | ||
for op_name in ["second", "third"]: | ||
assert add_operation(op_name, "description") | ||
assert add_user_to_operation(path=op_name, emailid=self.userdata[0]) | ||
|
||
self._connect_to_mscolab(qtbot) | ||
modify_config_file({"MSS_auth": {self.url: self.userdata[0]}}) | ||
self._login(qtbot, emailid=self.userdata[0], password=self.userdata[2]) | ||
|
||
# test after activating operation | ||
self._activate_operation_at_index(0) | ||
self.window.actionTopView.trigger() | ||
|
||
def assert_active_views(): | ||
# check 1 view opened | ||
assert len(self.window.get_active_views()) == 1 | ||
qtbot.wait_until(assert_active_views) | ||
topview_0 = self.window.listViews.item(0) | ||
assert topview_0.window.tv_window_exists is True | ||
topview_0.window.setAttribute(QtCore.Qt.WA_DeleteOnClose) | ||
|
||
def assert_attribute(): | ||
assert topview_0.window.testAttribute(QtCore.Qt.WA_DeleteOnClose) | ||
qtbot.wait_until(assert_attribute) | ||
Comment on lines
+440
to
+442
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am pretty sure that setAttribute is an immediate action that does not require this kind of wait, but I wouldn't know how to find out if this is definitely the case. |
||
|
||
# open multiple flightpath first window | ||
topview_0.window.cbTools.currentIndexChanged.emit(6) | ||
|
||
def assert_dock_loaded(): | ||
assert topview_0.window.docks[5] is not None | ||
qtbot.wait_until(assert_dock_loaded) | ||
|
||
# activate all operation, this enables them in the docking widget too | ||
self._activate_operation_at_index(1) | ||
self._activate_operation_at_index(2) | ||
self._activate_operation_at_index(0) | ||
# ToDo refactor to be able to activate/deactivate by the docking widget and that it can be checked | ||
|
||
self._activate_flight_track_at_index(0) | ||
with mock.patch("PyQt5.QtWidgets.QMessageBox.warning", return_value=QtWidgets.QMessageBox.Yes): | ||
topview_0.window.close() | ||
|
||
def assert_window_closed(): | ||
assert topview_0.window.tv_window_exists is False | ||
qtbot.wait_until(assert_window_closed) | ||
|
||
def assert_label_text(): | ||
# verify logged in | ||
assert self.window.usernameLabel.text() == self.userdata[1] | ||
qtbot.wait_until(assert_label_text) | ||
Comment on lines
+465
to
+468
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
self.window.mscolab.logout() | ||
|
||
def assert_logout_text(): | ||
assert self.window.usernameLabel.text() == "User" | ||
qtbot.wait_until(assert_logout_text) | ||
|
||
self._connect_to_mscolab(qtbot) | ||
self._login(qtbot, emailid=self.userdata[0], password=self.userdata[2]) | ||
# verify logged in again | ||
qtbot.wait_until(assert_label_text) | ||
# ToDo verify all operations disabled again without a visual check | ||
|
||
@mock.patch("PyQt5.QtWidgets.QFileDialog.getSaveFileName", | ||
return_value=(fs.path.join(mscolab_settings.MSCOLAB_DATA_DIR, 'test_export.ftml'), | ||
"Flight track (*.ftml)")) | ||
|
@@ -828,3 +896,12 @@ def _activate_operation_at_index(self, index): | |
point = self.window.listOperationsMSC.visualItemRect(item).center() | ||
QtTest.QTest.mouseClick(self.window.listOperationsMSC.viewport(), QtCore.Qt.LeftButton, pos=point) | ||
QtTest.QTest.mouseDClick(self.window.listOperationsMSC.viewport(), QtCore.Qt.LeftButton, pos=point) | ||
|
||
def _activate_flight_track_at_index(self, index): | ||
# The main window must be on top | ||
self.window.activateWindow() | ||
# get the item by its index | ||
item = self.window.listFlightTracks.item(index) | ||
point = self.window.listFlightTracks.visualItemRect(item).center() | ||
QtTest.QTest.mouseClick(self.window.listFlightTracks.viewport(), QtCore.Qt.LeftButton, pos=point) | ||
QtTest.QTest.mouseDClick(self.window.listFlightTracks.viewport(), QtCore.Qt.LeftButton, pos=point) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those lines were duplicated