def test_create_task_raise_if_authenticated_but_not_admin(self): with self.assertRaises(PermissionDenied): client.create_task( _make_request( is_authenticated=False, is_superuser=False, ), {})
def test_create_task(self): task_id = client.create_task(_make_request(self._user), { 'owner_name': self._user.username, 'label': 'task', 'method': 'method', }) self.assertTrue(task_id > 0) task = Task.objects.get(id=task_id) self.assertEqual(task.resubmitted_by.id, self._user.id) self.assertIsNone(task.resubmitted_from)
def test_create_task_based_on_task(self): base_task_id = Task.create_task(self._user.username, 'task', 'method') clone_task_id = client.create_task(_make_request(self._user), { 'task_id': base_task_id, }) self.assertTrue(clone_task_id > 0) self.assertNotEqual(base_task_id, clone_task_id) task = Task.objects.get(id=clone_task_id) self.assertEqual(task.resubmitted_by.id, self._user.id) self.assertEqual(task.resubmitted_from.id, base_task_id)
def test_create_task_raise_if_authenticated_but_not_admin(self): with self.assertRaises(PermissionDenied): client.create_task(_make_request( is_authenticated=False, is_superuser=False, ), {})