Skip to content

Commit f3b7881

Browse files
authored
Merge pull request #1970 from codalab/develop
Rebase fixedMCversion
2 parents bce1792 + 9be371c commit f3b7881

1 file changed

Lines changed: 45 additions & 46 deletions

File tree

src/apps/api/tests/test_tasks.py

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,51 @@
33
from rest_framework.test import APITestCase
44
from rest_framework import status
55

6-
from competitions.models import Submission
7-
from factories import UserFactory, CompetitionFactory, TaskFactory, SolutionFactory, PhaseFactory, SubmissionFactory, DataFactory
8-
9-
10-
class TestTasks(APITestCase):
11-
def test_task_shown_as_validated_properly(self):
12-
user = UserFactory(username='test')
13-
solution = SolutionFactory(md5="12345")
14-
task = TaskFactory(created_by=user, solutions=[solution])
15-
competition = CompetitionFactory(created_by=user)
16-
phase = PhaseFactory(competition=competition, tasks=[task])
17-
submission = SubmissionFactory(md5="12345", phase=phase, status=Submission.FINISHED)
18-
url = reverse('task-detail', kwargs={'pk': task.id})
19-
self.client.login(username=user.username, password='test')
20-
21-
# task should be validated because we have a successful submission matching
22-
# our solution
23-
resp = self.client.get(url)
24-
assert resp.status_code == 200
25-
assert resp.data["validated"]
26-
27-
# make submission anything but Submission.FINISHED, task -> invalidated
28-
submission.status = Submission.FAILED
29-
submission.save()
30-
resp = self.client.get(url)
31-
assert resp.status_code == 200
32-
assert not resp.data["validated"]
33-
34-
# make submission Submission.Finished, task -> re-validated
35-
submission.status = Submission.FINISHED
36-
submission.save()
37-
resp = self.client.get(url)
38-
assert resp.status_code == 200
39-
assert resp.data["validated"]
40-
41-
# delete submission, task -> re-invalidated
42-
submission.delete()
43-
resp = self.client.get(url)
44-
assert resp.status_code == 200
45-
assert not resp.data["validated"]
46-
47-
# make submission with different Sha -> still invalid
48-
SubmissionFactory(md5="different", phase=phase, status=Submission.FINISHED)
49-
resp = self.client.get(url)
50-
assert resp.status_code == 200
51-
assert not resp.data["validated"]
6+
from factories import UserFactory, DataFactory
7+
8+
# Removed this test because of the changes of this PR : https://github.com/codalab/codabench/pull/1963
9+
# class TestTasks(APITestCase):
10+
# def test_task_shown_as_validated_properly(self):
11+
# user = UserFactory(username='test')
12+
# solution = SolutionFactory(md5="12345")
13+
# task = TaskFactory(created_by=user, solutions=[solution])
14+
# competition = CompetitionFactory(created_by=user)
15+
# phase = PhaseFactory(competition=competition, tasks=[task])
16+
# submission = SubmissionFactory(md5="12345", phase=phase, status=Submission.FINISHED)
17+
# url = reverse('task-detail', kwargs={'pk': task.id})
18+
# self.client.login(username=user.username, password='test')
19+
20+
# # task should be validated because we have a successful submission matching
21+
# # our solution
22+
# resp = self.client.get(url)
23+
# assert resp.status_code == 200
24+
# assert resp.data["validated"]
25+
26+
# # make submission anything but Submission.FINISHED, task -> invalidated
27+
# submission.status = Submission.FAILED
28+
# submission.save()
29+
# resp = self.client.get(url)
30+
# assert resp.status_code == 200
31+
# assert not resp.data["validated"]
32+
33+
# # make submission Submission.Finished, task -> re-validated
34+
# submission.status = Submission.FINISHED
35+
# submission.save()
36+
# resp = self.client.get(url)
37+
# assert resp.status_code == 200
38+
# assert resp.data["validated"]
39+
40+
# # delete submission, task -> re-invalidated
41+
# submission.delete()
42+
# resp = self.client.get(url)
43+
# assert resp.status_code == 200
44+
# assert not resp.data["validated"]
45+
46+
# # make submission with different Sha -> still invalid
47+
# SubmissionFactory(md5="different", phase=phase, status=Submission.FINISHED)
48+
# resp = self.client.get(url)
49+
# assert resp.status_code == 200
50+
# assert not resp.data["validated"]
5251

5352

5453
class TestUploadTask(APITestCase):

0 commit comments

Comments
 (0)