Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
 def get_awaited_tasks(self, awaited_task_list):
     return worker.get_awaited_tasks(self._request, awaited_task_list)
Ejemplo n.º 6
0
 def test_get_awaited_tasks(self):
     with self.assertRaises(PermissionDenied):
         worker.get_awaited_tasks(_make_request(None, False), [])
Ejemplo n.º 7
0
 def test_get_awaited_tasks(self):
     with self.assertRaises(PermissionDenied):
         worker.get_awaited_tasks(_make_request(None, False), [])