def test_get_awaited_tasks_if_empty_task_list(self): t_parent = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], ) Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], awaited=True, parent=t_parent, ) req = _make_request(self._worker) tasks = worker.get_awaited_tasks(req, []) self.assertEqual(len(tasks), 0)
def test_get_awaited_tasks_if_empty_task_list(self): t_parent = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], ) Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], awaited=True, parent=t_parent, ) req = _make_request(self._worker) tasks = worker.get_awaited_tasks(req, []) self.assertEqual(len(tasks), 0)
def test_get_awaited_tasks(self): t1 = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], ) t2 = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], awaited=True, parent=t1, ) req = _make_request(self._worker) tasks = worker.get_awaited_tasks(req, [t1.export()]) self.assertEqual(len(tasks), 1) self.assertEqual(tasks[0]['id'], t2.id)
def test_get_awaited_tasks(self): t1 = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], ) t2 = Task.objects.create( worker=self._worker, arch=self._arch, channel=self._channel, owner=self._user, state=TASK_STATES['FREE'], awaited=True, parent=t1, ) req = _make_request(self._worker) tasks = worker.get_awaited_tasks(req, [t1.export()]) self.assertEqual(len(tasks), 1) self.assertEqual(tasks[0]['id'], t2.id)
def get_awaited_tasks(self, awaited_task_list): return worker.get_awaited_tasks(self._request, awaited_task_list)
def test_get_awaited_tasks(self): with self.assertRaises(PermissionDenied): worker.get_awaited_tasks(_make_request(None, False), [])
def test_get_awaited_tasks(self): with self.assertRaises(PermissionDenied): worker.get_awaited_tasks(_make_request(None, False), [])