Skip to content
Snippets Groups Projects
Verified Commit 446e26ee authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Just fix the test

parent 38c21c62
No related branches found
No related tags found
1 merge request!2265Accelerate execution of test_task_details
This commit is part of merge request !2265. Comments created here will be created in the context of that merge request.
...@@ -111,20 +111,18 @@ class TestAPI(FixtureAPITestCase): ...@@ -111,20 +111,18 @@ class TestAPI(FixtureAPITestCase):
resp = self.client.get(reverse("api:task-details", args=[self.task1.id])) resp = self.client.get(reverse("api:task-details", args=[self.task1.id]))
self.assertEqual(resp.status_code, status.HTTP_403_FORBIDDEN) self.assertEqual(resp.status_code, status.HTTP_403_FORBIDDEN)
@patch("arkindex.project.aws.s3") @patch("arkindex.project.mixins.get_max_level")
@expectedFailure def test_task_details_requires_process_guest(self, get_max_level_mock):
def test_task_details_requires_process_guest(self): get_max_level_mock.return_value = None
self.process.creator = self.superuser
self.process.save()
self.corpus.memberships.filter(user=self.user).delete()
self.corpus.public = False
self.corpus.save()
self.client.force_login(self.user) self.client.force_login(self.user)
with self.assertNumQueries(5): with self.assertNumQueries(3):
resp = self.client.get(reverse("api:task-details", args=[self.task1.id])) resp = self.client.get(reverse("api:task-details", args=[self.task1.id]))
self.assertEqual(resp.status_code, status.HTTP_403_FORBIDDEN) self.assertEqual(resp.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(get_max_level_mock.call_count, 1)
self.assertEqual(get_max_level_mock.call_args, call(self.user, self.corpus))
@patch("arkindex.project.aws.s3") @patch("arkindex.project.aws.s3")
def test_task_details_process_level_corpus(self, s3_mock): def test_task_details_process_level_corpus(self, s3_mock):
s3_mock.Object.return_value.bucket_name = "ponos" s3_mock.Object.return_value.bucket_name = "ponos"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment