project.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:django-open-volunteering-platform 作者: OpenVolunteeringPlatform 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号