コード例 #1
0
ファイル: crud.py プロジェクト: kreopt/aioweb
 async def test_003_edit( self ):
     post_data = await self.post_data_with_csrf()
     model_id = self.collection[0].id
     rsp= await self.client.post("/TABLE/{}".format(model_id), data=post_data)
     controller=self.app.last_controller
     self.assertEqual(rsp.status, 200)
     model=MODEL_CLASS.find(model_id)
     self.assertEqual(getattr(model, self.test_field), self.test_field_value)
コード例 #2
0
async def set_model(ctrl):
    ctrl.model = MODEL_CLASS.find((await ctrl.params())["id"])
    if not ctrl.model:
        raise web.HTTPNotFound