增加了公告的API接口和相应的API测试
This commit is contained in:
16
announcement/tests.py
Normal file
16
announcement/tests.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# coding=utf-8
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from rest_framework.test import APITestCase, APIClient
|
||||
|
||||
|
||||
class AbstractAnnouncementAPITest(APITestCase):
|
||||
def setUp(self):
|
||||
self.client = APIClient()
|
||||
self.url = reverse("announcement_api")
|
||||
|
||||
def test_invalid_format(self):
|
||||
# todo 判断用户是否登录
|
||||
data = {"title": "test1"}
|
||||
response = self.client.post(self.url, data=data)
|
||||
self.assertEqual(response.data["code"], 1)
|
||||
Reference in New Issue
Block a user