diff --git a/nxdrive/gui/application.py b/nxdrive/gui/application.py index 39d91da1a3..ae4d186e34 100644 --- a/nxdrive/gui/application.py +++ b/nxdrive/gui/application.py @@ -219,9 +219,7 @@ def __init__(self, manager: "Manager", *args: Any) -> None: self._setup_notification_center() # Initiate workflow when drive starts - self.workflow, current_uid, engine = self.init_workflow() # type: ignore - self.workflow.get_pending_tasks(current_uid, engine) - + self.workflow = self.init_workflow() # type: ignore # Application update self.manager.updater.appUpdated.connect(self.quit) self.manager.updater.serverIncompatible.connect(self._server_incompatible) @@ -384,7 +382,8 @@ def init_workflow(self): # type: ignore current_uid = self.engine_model.engines_uid[0] engine = self.manager.engines[current_uid] self.workflow = Workflow(engine.remote) - return self.workflow, current_uid, engine + self.workflow.get_pending_tasks(engine) + return self.workflow def _update_feature_state(self, name: str, value: bool, /) -> None: """Check if the feature model exists from *name* then update it with *value*.""" diff --git a/tests/unit/test_workflow.py b/tests/unit/test_workflow.py index d53f6352f7..0b42e8df76 100644 --- a/tests/unit/test_workflow.py +++ b/tests/unit/test_workflow.py @@ -150,7 +150,20 @@ def test_api_display_pending_task_with_exec(application, manager): ) -def test_init_workflow_with_app(application): - application.manager.engines = {"engine_uid_1": Mock(), "engine_uid_2": Mock()} +def test_init_workflow_with_app(tmp_path): + from nxdrive.manager import Manager - application.init_gui() + manager = Manager(tmp_path) + manager.db_backup_worker = Mock() + + manager.autolock_service = Mock() + manager.server_config_updater = Mock() + manager._create_server_config_updater = Mock() + manager.sync_and_quit_worker = Mock() + manager._create_db_backup_worker = Mock() + manager._create_workflow_worker = Mock() + + app = Application(manager) + + app.init_workflow() + app.exit_app()