示例#1
0
 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()