def post(self): restaurant_name = self.request.get(NAME) restaurant_uid = self.request.get(RESTAURANT_UID) restaurant_image_data = self.request.get(IMAGE_DATA) image = Image.from_image_data(restaurant_image_data) image.put() restaurant = restaurant_logic.add(restaurant_uid, restaurant_name, image.key) self.send_response(restaurant)
def post(self): restaurant_uid = self.request.get(RESTAURANT_UID) category_name = self.request.get(CATEGORY_NAME) dish_name = self.request.get(NAME) dish_image_data = self.request.get(IMAGE_DATA) img_key = None if dish_image_data: image = Image.from_image_data(dish_image_data) image.put() img_key = image.key dish = dish_logic.add(restaurant_uid, category_name, dish_name, img_key) self.send_response(dish)
def testInsertEntity(self): image = Image.from_image_data(self.image_data) image.put() self.assertEqual('image/png', image.mimetype) self.assertEqual(1, len(image.query().fetch(2)))