Skip to content

Commit

Permalink
NXDRIVE-2889: Display system notification for document review
Browse files Browse the repository at this point in the history
  • Loading branch information
swetayadav1 committed Mar 19, 2024
1 parent 19a5fcb commit 10e8417
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/functional/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import namedtuple
from unittest.mock import patch
from uuid import uuid4

from nxdrive.gui.api import QMLDriveApi

Expand Down Expand Up @@ -52,3 +53,47 @@ def mocked_open_authentication_dialog():
with manager:
returned_val = drive_api.get_features_list()
assert returned_val


def test_balance_percents(manager_factory):
manager = manager_factory(with_engine=False)
manager.application = ""

def mocked_open_authentication_dialog():
return

Mocked_App = namedtuple(
"app",
"manager, open_authentication_dialog",
defaults=(manager, mocked_open_authentication_dialog),
)
app = Mocked_App()
drive_api = QMLDriveApi(app)

with manager:
returned_val = drive_api._balance_percents(
{"key_1": 10.1, "key_2": 20, "key_3": 20.5}
)
assert returned_val


def test_display_pending_task(manager_factory):
manager = manager_factory(with_engine=False)
manager.application = ""

def mocked_open_authentication_dialog():
return

Mocked_App = namedtuple(
"app",
"manager, open_authentication_dialog",
defaults=(manager, mocked_open_authentication_dialog),
)
app = Mocked_App()
drive_api = QMLDriveApi(app)

with manager:
returned_val = drive_api.display_pending_task(
str(uuid4()), str(uuid4()), "/doc_path"
)
assert returned_val is None
16 changes: 16 additions & 0 deletions tests/functional/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pytest

from nxdrive.exceptions import NoAssociatedSoftware
from nxdrive.gui.application import Application
from nxdrive.poll_workers import WorkflowWorker

from ..markers import windows_only

Expand All @@ -29,6 +31,20 @@ def startfile(path):
manager.open_local_file("File.azerty")


def test_workflow(manager_factory):
manager, _ = manager_factory()
with manager:
workflow_worker = WorkflowWorker(manager)
assert workflow_worker._poll()
assert not workflow_worker._first_workflow_check
workflow_worker.quit()

manager.app = Application(manager)
manager.app.exit_app()
assert workflow_worker._poll()
workflow_worker.quit()


# This test is commented because it causes other ft tests to fails
# @Options.mock()
# def test_manager_init_failed_migrations(manager_factory, tmp_path, monkeypatch):
Expand Down

0 comments on commit 10e8417

Please sign in to comment.