コード例 #1
0
ファイル: trade.py プロジェクト: kel4416/Spacegem2012
 def post(self):
     try:
         tRequest = json.loads(self.request.body)
         sender = tRequest["sender"]
         recipient = tRequest["recipient"]
         goods = tRequest["goods"]
         amount = tRequest["amount"]
         price = tRequest["price"]
         newTRequest = TradeRequest()
         newTRequest.sender = sender
         newTRequest.recipient = recipient
         newTRequest.goods = int(goods)
         newTRequest.amount = int(amount)
         newTRequest.price = int(price)
         newTRequest.put()
         self.response.out.write("Successful")
     except:
         self.response.out.write("Failed")
コード例 #2
0
 def test_saved_entity(self):
     entity = TradeRequest(sender='*****@*****.**')
     key = entity.put()
     self.assertEqual('*****@*****.**', db.get(key).sender)
コード例 #3
0
 def setUp(self):
     # Populate test entities.
     entity = TradeRequest(sender='*****@*****.**')
     self.setup_key = entity.put()