Skip to content

Commit

Permalink
Update test_api.py 00002
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofanindya authored Oct 30, 2023
1 parent 4df9c5f commit 874f7b4
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/functional/test_api.py
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

0 comments on commit 874f7b4

Please sign in to comment.