Ejemplo n.º 1
0
 def test_delete(self):
         image = Image.create(data=self.image_bytes, filename=TEST_IMAGE_PATH)
         self.assertIsNotNone(image.blob_info)
         blob_key = image.blob_key
         self.assertEqual(image.get_serving_url(), images.get_serving_url(blob_key))
         self.assertEqual(Image.all().count(), 1)
         image.delete()
         self.assertEqual(Image.all().count(), 0)
Ejemplo n.º 2
0
 def test_create_with_data(self):
     image = Image.create(data=self.image_bytes, filename=TEST_IMAGE_PATH)
     self.assertIsNotNone(image.blob_info)
     self.assertEqual(Image.all().count(), 1)
     self.assertMemcacheItems(0)
     self.assertEqual(image.get_serving_url(), images.get_serving_url(image.blob_key))
     self.assertMemcacheItems(1)
     self.assertMemcacheHits(0)
     self.assertEqual(image.get_serving_url(), images.get_serving_url(image.blob_key))
     self.assertMemcacheHits(1)
     image2 = Image.create(data=self.image_bytes, filename=TEST_IMAGE_PATH)
     self.assertNotEqual(image.get_serving_url(), images.get_serving_url(image2.blob_key))
     self.assertMemcacheItems(1)
     self.assertMemcacheHits(2)
     self.assertEqual(image2.get_serving_url(), images.get_serving_url(image2.blob_key))
     self.assertMemcacheItems(2)
     self.assertMemcacheHits(2)