Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RabiyaF committed Sep 2, 2024
1 parent 209157b commit 363314e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/test_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_project_dialog_initial_state(setup_project_dialog_widget):
assert project_dialog.project_folder_error.isHidden()
assert project_dialog.project_folder.isReadOnly()


@patch("os.listdir")
def test_inline_error_msgs(mock_listdir, setup_project_dialog_widget):
"""
Expand All @@ -71,21 +72,21 @@ def test_inline_error_msgs(mock_listdir, setup_project_dialog_widget):

mock_listdir.return_value = [".hiddenfile"]

# tests the project name and folder line edit errors displayed.
# tests the project name and folder inline errors.
project_dialog.create_button.click()

assert not project_dialog.project_name_error.isHidden()
assert not project_dialog.project_folder_error.isHidden()

# tests the project name line edit error displayed.
# tests the project name inline error.
project_dialog.project_folder.setText("test-folder")
project_dialog.folder_path = "test-folder"
project_dialog.create_button.click()

assert not project_dialog.project_name_error.isHidden()
assert project_dialog.project_folder_error.isHidden()

# tests the project folder line edit error displayed.
# tests the project folder inline error.
project_dialog.project_name.setText("test-name")
project_dialog.project_folder.setText("")
project_dialog.folder_path = ""
Expand All @@ -94,9 +95,10 @@ def test_inline_error_msgs(mock_listdir, setup_project_dialog_widget):
assert project_dialog.project_name_error.isHidden()
assert not project_dialog.project_folder_error.isHidden()


@patch("os.listdir")
@patch.object(MockPresenter, "createProject")
def test_create_button(mock_create_new_project, mock_listdir, setup_project_dialog_widget):
def test_create_button(mock_create_project, mock_listdir, setup_project_dialog_widget):
"""
Tests create button on the ProjectDialog class.
"""
Expand All @@ -106,10 +108,9 @@ def test_create_button(mock_create_new_project, mock_listdir, setup_project_dial

project_dialog.project_name.setText("test-name")
project_dialog.project_folder.setText("test-folder")
project_dialog.folder_selected = True
project_dialog.folder_path = "test-folder"
project_dialog.create_button.click()
mock_create_new_project.assert_called_once()
mock_create_project.assert_called_once()
assert project_dialog.parent().toolbar.isEnabled()


Expand Down

0 comments on commit 363314e

Please sign in to comment.