示例#1
0
 def _test_process_image(self, image):
     image_file = self._get_image_file(image)
     # run
     new_file = media_api.process_image(image_file)
     # assert
     pil_image = Image.open(new_file)
     self.assertTrue(hasattr(pil_image, 'png'), 'Must be converted to PNG')
     self.assertTrue(pil_image.size <= (128, 128), 'Size must be 128 by 128 or smaller')
     self.assertTrue(new_file.endswith('.png'))
示例#2
0
    def _test_process_error_image(self, image):
        image_file = self._get_image_file(image)

        try:
            _ = media_api.process_image(image_file)
        except media_api.UploadImageError:
            return
        except:
            pass

        self.assertTrue(False, 'UploadImageError not raised')