Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit2p committed Apr 13, 2024
1 parent f702dfb commit 1c2191f
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions tests/_test_msui/test_mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import requests.exceptions
import mock
import pytest
import random

import mslib.utils.auth
from mslib.mscolab.conf import mscolab_settings
Expand Down Expand Up @@ -433,42 +434,30 @@ def assert_active_views():
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)

# open multiple flightpath
topview_0.window.cbTools.currentIndexChanged.emit(6)

# activate all operation, this enables them in the docking widget too
for _ in range(4):
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():
ref = weakref.ref(topview_0.window)
assert ref() is None
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)
for _ in range(6):
self._activate_operation_at_index(random.randint(0, 2))
self._activate_operation_at_index(random.randint(0, 2))
self._activate_operation_at_index(random.randint(0, 2))
self._activate_flight_track_at_index(0)

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
with pytest.raises(TypeError):
for _ in range(6):
self._activate_operation_at_index(random.randint(0, 2))
self._activate_operation_at_index(random.randint(0, 2))
self._activate_operation_at_index(random.randint(0, 2))

@mock.patch("PyQt5.QtWidgets.QFileDialog.getSaveFileName",
return_value=(fs.path.join(mscolab_settings.MSCOLAB_DATA_DIR, 'test_export.ftml'),
Expand Down

0 comments on commit 1c2191f

Please sign in to comment.