def test_empty_job_or_work(self):
"""Test empty job or work returns error"""
self.data["disponibility"] = {"type": "job"}
response = self.client.post(reverse("project-list"), self.data, format="json")
self.assertTrue(response.data["disponibility"]["job"] == ["This field is required if type=\"job\"."])
self.assertTrue(response.status_code == 400)
self.data["disponibility"] = {"type": "work"}
response = self.client.post(reverse("project-list"), self.data, format="json")
self.assertTrue(response.data["disponibility"]["work"] == ["This field is required if type=\"work\"."])
self.assertTrue(response.status_code == 400)
# def test_work_description_required(self):
# """Test work description is required"""
# self.data["disponibility"] = {"type": "work", "work": {}}
# response = self.client.post(reverse("project-list"), self.data, format="json")
# self.assertTrue(response.data["disponibility"]["work"]["description"] == ["This field is required."])
# self.assertTrue(response.status_code == 400)
project.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录