add test case upload api
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from utils.api.tests import APITestCase
|
||||
|
||||
from .models import ProblemTag
|
||||
from .views.admin import TestCaseUploadAPI
|
||||
|
||||
|
||||
class ProblemTagListAPITest(APITestCase):
|
||||
@@ -10,3 +11,15 @@ class ProblemTagListAPITest(APITestCase):
|
||||
resp = self.client.get(self.reverse("problem_tag_list_api"))
|
||||
self.assertSuccess(resp)
|
||||
self.assertEqual(resp.data["data"], ["name1", "name2"])
|
||||
|
||||
|
||||
class TestCaseUploadAPITest(APITestCase):
|
||||
def setUp(self):
|
||||
self.api = TestCaseUploadAPI()
|
||||
|
||||
def test_filter_file_name(self):
|
||||
self.assertEqual(self.api.filter_name_list(["1.in", "1.out", "2.in", ".DS_Store"], spj=False), ["1.in", "1.out"])
|
||||
self.assertEqual(self.api.filter_name_list(["2.in", "2.out"], spj=False), [])
|
||||
|
||||
self.assertEqual(self.api.filter_name_list(["1.in", "1.out", "2.in"], spj=True), ["1.in", "2.in"])
|
||||
self.assertEqual(self.api.filter_name_list(["2.in", "3.in"], spj=True), [])
|
||||
|
||||
Reference in New Issue
Block a user