添加contest权限验证、contest密码验证api

添加problem、contest单元测试。
This commit is contained in:
zemal
2017-07-18 11:18:18 +08:00
parent 53d0cae8ea
commit ee49d0a815
9 changed files with 136 additions and 19 deletions

View File

@@ -74,6 +74,16 @@ class ContestAPITest(APITestCase):
response = self.client.get("{}?id={}".format(self.url, contest_id))
self.assertSuccess(response)
def test_contest_password(self):
contest_id = self.create_contest().data["data"]["id"]
self.create_user("test", "test123")
url = self.reverse("contest_password_api")
resp = self.client.post(url, {"contest_id": contest_id, "password": "error_password"})
self.assertFailed(resp)
resp = self.client.post(url, {"contest_id": contest_id, "password": DEFAULT_CONTEST_DATA["password"]})
self.assertSuccess(resp)
class ContestAnnouncementAPITest(APITestCase):
def setUp(self):