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))
tournament_handler_test.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录