diff --git a/tests/functional/test_api.py b/tests/functional/test_api.py index 733d5aef2d..11d35bad3a 100644 --- a/tests/functional/test_api.py +++ b/tests/functional/test_api.py @@ -1,3 +1,4 @@ +from collections import namedtuple from unittest.mock import patch from nxdrive.gui.api import QMLDriveApi @@ -5,19 +6,31 @@ def test_web_authentication(manager_factory, nuxeo_url): - manager, engine = manager_factory() + manager = manager_factory(with_engine=False) + manager.application = "" - def func(val): + def func(*args): return True + + def mocked_open_authentication_dialog(): + return - app = Application(manager) + Mocked_App = namedtuple( + "app", + "manager, open_authentication_dialog", + defaults=(manager, mocked_open_authentication_dialog), + ) + app = Mocked_App() + + # app = Application(manager) drive_api = QMLDriveApi(app) with manager: with patch.object(manager, "check_local_folder_available", new=func): + url = nuxeo_url + "/login.jsp?requestedUrl=ui" returned_val = drive_api.web_authentication( - nuxeo_url + "/login.jsp?requestedUrl=ui", + url, "/dummy-path", True, ) - assert not returned_val + assert returned_val