reformat code.

This commit is contained in:
zemal
2017-07-18 11:25:08 +08:00
parent ee49d0a815
commit 8b85f86124
6 changed files with 11 additions and 17 deletions

View File

@@ -99,4 +99,4 @@ class ContestProblemSerializer(serializers.ModelSerializer):
created_by = UsernameSerializer()
class Meta:
model = ContestProblem
model = ContestProblem

View File

@@ -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)

View File

@@ -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