reformat code.
This commit is contained in:
@@ -99,4 +99,4 @@ class ContestProblemSerializer(serializers.ModelSerializer):
|
||||
created_by = UsernameSerializer()
|
||||
|
||||
class Meta:
|
||||
model = ContestProblem
|
||||
model = ContestProblem
|
||||
|
||||
@@ -208,18 +208,17 @@ class ContestProblemTest(APITestCase):
|
||||
def test_get_one_contest_problem(self):
|
||||
contest_id = self.contest.data["data"]["id"]
|
||||
problem_id = self.problem.data["data"]["_id"]
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url,contest_id, problem_id))
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url, contest_id, problem_id))
|
||||
self.assertSuccess(resp)
|
||||
|
||||
def test_regular_user_get_contest_problem(self):
|
||||
self.create_user("test", "test123")
|
||||
contest_id = self.contest.data["data"]["id"]
|
||||
problem_id = self.problem.data["data"]["_id"]
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url,contest_id, problem_id))
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url, contest_id, problem_id))
|
||||
self.assertFailed(resp)
|
||||
|
||||
url = self.reverse("contest_password_api")
|
||||
self.client.post(url, {"contest_id": contest_id, "password": DEFAULT_CONTEST_DATA["password"]})
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url,contest_id, problem_id))
|
||||
resp = self.client.get("{}?contest_id={}&problem_id={}".format(self.url, contest_id, problem_id))
|
||||
self.assertSuccess(resp)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.db.models import Q
|
||||
from utils.api import APIView
|
||||
from account.decorators import login_required, check_contest_permission
|
||||
from account.decorators import check_contest_permission
|
||||
from ..models import ProblemTag, Problem, ContestProblem
|
||||
from ..serializers import ProblemSerializer, TagSerializer
|
||||
from ..serializers import ContestProblemSerializer
|
||||
|
||||
Reference in New Issue
Block a user