tournament_handler_test.py 文件源码

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

项目:tichu-tournament 作者: aragos 项目源码 文件源码
def testDeleteTournament(self):
    self.loginUser()
    id = self.AddBasicTournament()
    id2 = self.AddBasicTournament()
    self.assertEqual(16, len(ndb.Query(kind = "PlayerPair").fetch()))
    response = self.testapp.delete("/api/tournaments/{}".format(id))
    self.assertEqual(response.status_int, 204)
    response = self.testapp.get("/api/tournaments/{}".format(id),
                                expect_errors=True)
    self.assertEqual(response.status_int, 404)
    self.assertEqual(8, len(ndb.Query(kind = "PlayerPair").fetch()))
    response = self.testapp.get("/api/tournaments")
    tourneys = json.loads(response.body)
    self.assertIsNotNone(tourneys["tournaments"])
    self.assertEqual(1, len(tourneys["tournaments"]))
    self.assertEqual(id2, tourneys["tournaments"][0]["id"])
    response = self.testapp.get("/api/tournaments/{}".format(id2),
                                expect_errors=True)
    self.CheckBasicTournamentMetadataUnchanged(json.loads(response.body))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号