Skip to content

Commit

Permalink
Unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbecker42 committed May 16, 2024
1 parent 648f954 commit 91f4b6e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_locked_sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,21 @@ def test_get_task_id_and_duration_for_project_user_missing(self):
assert get_task_id_project_id_key(task.id).encode() in sentinel.master.keys()
assert task.id == task_id

@with_context
@patch('pybossa.core.task_repo.get_task')
def get_task_id_and_duration_for_project_user_invalid_task_id(self, get_task):
user = UserFactory.create()
project = ProjectFactory.create(owner=user, short_name='egil', name='egil',
description='egil')
task = TaskFactory.create_batch(1, project=project, n_answers=1)[0]
limit = 1
timeout = 100
acquire_locks(task.id, user.id, limit, timeout)
task_id, seconds = get_task_id_and_duration_for_project_user(project.id, user.id)

assert task_id is None
assert seconds == -1

@with_context
def test_tasks_assigned_as_per_user_access_levels_l1(self):
""" Test tasks assigned by locked scheduler are as per access levels set for user, task and project"""
Expand Down

0 comments on commit 91f4b6e

Please sign in to comment.