Skip to content

Commit

Permalink
Fix spell and type annotation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
swetayadav1 committed Jun 17, 2024
1 parent 9c157c2 commit 661f6bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nxdrive/client/workflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Workflow:
"""Workflow Management for document Review"""

user_task_list = {}
user_task_list: Dict[str, List[str]] = {}

def __init__(self, remote: "Remote") -> None:
self.remote = remote
Expand Down
2 changes: 1 addition & 1 deletion nxdrive/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ def unbind_engine(self, uid: str, /, *, purge: bool = False) -> None:
return

if Feature.tasks_management:

Check warning on line 946 in nxdrive/manager.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/manager.py#L946

Added line #L946 was not covered by tests
# Clean user tasks data incase we are unbinding the account.
# Clean user tasks data in case we are unbinding the account.
self.workflow = Workflow(engine.remote)
self.workflow.clean_user_task_data(engine.remote.user_id)

Check warning on line 949 in nxdrive/manager.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/manager.py#L948-L949

Added lines #L948 - L949 were not covered by tests

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_get_pending_task_for_single_doc(workflow, engine, task, remote):
engine.remote = remote
engine.remote.tasks.get = Mock(return_value=[task])
workflow.fetch_document = Mock()
assert workflow.get_pending_tasks(engine, False) is None
assert workflow.get_pending_tasks(engine) is None
assert Workflow.user_task_list == {"user_a": ["taskid_test"]}


Expand All @@ -109,12 +109,12 @@ def test_get_pending_task_for_multiple_doc(workflow, engine, task, remote):
engine.remote = remote
engine.remote.tasks.get = Mock(return_value=[task1, task2])
engine.send_task_notification = Mock()
assert workflow.get_pending_tasks(engine, False) is None
assert workflow.get_pending_tasks(engine) is None
assert Workflow.user_task_list == {"user_a": ["taskid_2", "taskid_2"]}

# user_task_list[a_user] have [tasks_a, tasks_b] and got tasks[tasks_a, tasks_b].
# In this case no need to the send notification
assert workflow.get_pending_tasks(engine, False) is None
assert workflow.get_pending_tasks(engine) is None
assert Workflow.user_task_list == {"user_a": ["taskid_2", "taskid_2"]}


Expand All @@ -124,11 +124,11 @@ def test_remove_overdue_tasks(workflow, engine, task, remote):
task.dueDate = datetime_1_hr_ago.strftime("%Y-%m-%dT%H:%M:%S.%f%z")
engine.remote.tasks.get = Mock(return_value=[task])
engine.send_task_notification = Mock()
assert workflow.get_pending_tasks(engine, False) is None
assert workflow.get_pending_tasks(engine) is None

# raise exception
task.dueDate = None
assert workflow.get_pending_tasks(engine, False) is None
assert workflow.get_pending_tasks(engine) is None


def test_fetch_document(workflow, engine, task):
Expand Down

0 comments on commit 661f6bf

Please sign in to comment.