-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4df9c5f
commit 874f7b4
Showing
1 changed file
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,23 +1,36 @@ | ||
from collections import namedtuple | ||
from unittest.mock import patch | ||
|
||
from nxdrive.gui.api import QMLDriveApi | ||
from nxdrive.gui.application import Application | ||
|
||
|
||
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 |