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")
def test_saved_entity(self): entity = TradeRequest(sender='*****@*****.**') key = entity.put() self.assertEqual('*****@*****.**', db.get(key).sender)
def setUp(self): # Populate test entities. entity = TradeRequest(sender='*****@*****.**') self.setup_key = entity.put()