示例#1
0
    def test_create_thumbnail(self):
        '''
        Tests that we can create a thumbnail
        '''
        #Copy test image to media area
        shutil.copy2(self.test_image, self.test_image_destination)

        image = Image(gallery=self.gallery, family=self.family, original_image=''.join(['galleries/', str(self.family.id), '/', str(self.gallery.id), '/test_image.jpg']))

        thumbnail = settings.MEDIA_ROOT + image._create_thumbnail((500,500))

        PIL.Image.open(thumbnail)

        #Clear up mess afterwards
        os.remove(self.test_image_destination)
        os.remove(thumbnail)
示例#2
0
    def test_create_thumbnail(self):
        '''
        Tests that we can create a thumbnail
        '''
        #Copy test image to media area
        shutil.copy2(self.test_image, self.test_image_destination)

        image = Image(gallery=self.gallery,
                      family=self.family,
                      original_image=''.join([
                          'galleries/',
                          str(self.family.id), '/',
                          str(self.gallery.id), '/test_image.jpg'
                      ]))

        thumbnail, image = image._create_thumbnail((500, 500))

        PIL.Image.open(settings.MEDIA_ROOT + thumbnail)

        #Clear up mess afterwards
        os.remove(self.test_image_destination)
        os.remove(settings.MEDIA_ROOT + thumbnail)