-
Notifications
You must be signed in to change notification settings - Fork 5
Fix failing unit tests #106
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
92d1332
Fix issues with unit tests
lauramurgatroyd 94f172e
Fix issues with session label
lauramurgatroyd d6d2cc6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 73f419c
Fix formatting
lauramurgatroyd ccdf0fa
Remove unused imports
lauramurgatroyd 05ff037
remove prints
lauramurgatroyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casperdcl marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casperdcl marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import unittest | ||
from unittest import mock | ||
|
||
from eqt.ui.MainWindowWithSessionManagement import MainWindowWithSessionManagement | ||
from eqt.ui.SessionDialogs import LoadSessionDialog | ||
|
||
from . import skip_ci | ||
|
||
# Unit tests for the MainWindowWithSessionManagement class | ||
# methods which create dialogs | ||
|
||
|
||
@skip_ci | ||
class TestMainWindowWithSessionManagementCreateLoadSessionDialog(unittest.TestCase): | ||
''' | ||
Tests the createLoadSessionDialog method of the MainWindowWithSessionManagement class | ||
|
||
This method is responsible for creating the load session dialog | ||
and populating it with the available sessions | ||
''' | ||
def setUp(self): | ||
self.title = "title" | ||
self.app_name = "app_name" | ||
self.smw = MainWindowWithSessionManagement(self.title, self.app_name) | ||
self.smw.sessions_directory = mock.MagicMock() | ||
self.zip_folders = ["zip_folder_1", "zip_folder_2"] | ||
|
||
def test_createLoadSessionDialog_populates_session_dropdown(self): | ||
dialog = self.smw.createLoadSessionDialog(self.zip_folders) | ||
assert dialog is not None | ||
assert isinstance(dialog, LoadSessionDialog) | ||
select_session_combo = dialog.getWidget('select_session') | ||
assert select_session_combo is not None | ||
items_in_combo = [ | ||
select_session_combo.itemText(i) for i in range(select_session_combo.count())] | ||
assert items_in_combo == self.zip_folders | ||
|
||
def test_createLoadSessionDialog_connections(self): | ||
dialog = self.smw.createLoadSessionDialog(self.zip_folders) | ||
|
||
self.smw.loadSessionLoad = mock.MagicMock() | ||
self.smw.selectLoadSessionsDirectorySelectedInSessionSelector = mock.MagicMock() | ||
self.smw.loadSessionNew = mock.MagicMock() | ||
|
||
dialog = self.smw.createLoadSessionDialog(self.zip_folders) | ||
|
||
dialog.Ok.click() | ||
self.smw.loadSessionLoad.assert_called_once() | ||
|
||
dialog.Select.click() | ||
self.smw.selectLoadSessionsDirectorySelectedInSessionSelector.assert_called_with(dialog) | ||
|
||
dialog.Cancel.click() | ||
self.smw.loadSessionNew.assert_called_once() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.