Example #1
0
 def test_cancel_task_raise_if_no_auth(self):
     with self.assertRaises(PermissionDenied):
         client.cancel_task(
             _make_request(
                 is_authenticated=False,
                 is_superuser=False,
             ), 999)
Example #2
0
    def test_cancel_task(self):
        task_id = Task.create_task(self._user.username, 'task', 'method')
        ret = client.cancel_task(_make_request(), task_id)
        self.assertIsNone(ret)

        t = Task.objects.get(id=task_id)
        self.assertEqual(t.state, TASK_STATES['CANCELED'])
    def test_cancel_task(self):
        task_id = Task.create_task(self._user.username, 'task', 'method')
        ret = client.cancel_task(_make_request(), task_id)
        self.assertIsNone(ret)

        t = Task.objects.get(id=task_id)
        self.assertEqual(t.state, TASK_STATES['CANCELED'])
Example #4
0
 def test_cancel_task_non_existent(self):
     ret = client.cancel_task(_make_request(), 999)
     self.assertEqual(ret, 'Specified task 999 does not exist.')
 def test_cancel_task_raise_if_no_auth(self):
     with self.assertRaises(PermissionDenied):
         client.cancel_task(_make_request(
             is_authenticated=False,
             is_superuser=False,
         ), 999)
 def test_cancel_task_non_existent(self):
     ret = client.cancel_task(_make_request(), 999)
     self.assertEqual(ret, 'Specified task 999 does not exist.')