def test_retina(self):
        get_thumbnail(self.image, '50x50')

        actions = [
            'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',

            # save regular resolution, same as in StorageTestCase
            'open: retina.jpg',
            'save: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
            'get_available_name: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
            'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',

            # save the 1.5x resolution version
            'save: test/cache/91/bb/[email protected]',
            'get_available_name: test/cache/91/bb/[email protected]',
            'exists: test/cache/91/bb/[email protected]',

            # save the 2x resolution version
            'save: test/cache/91/bb/[email protected]',
            'get_available_name: test/cache/91/bb/[email protected]',
            'exists: test/cache/91/bb/[email protected]'
        ]
        self.assertEqual(self.log, actions)

        path = os.path.join(
            settings.MEDIA_ROOT,
            'test/cache/91/bb/[email protected]')

        with open(path) as fp:
            engine = PILEngine()
            self.assertEqual(
                engine.get_image_size(engine.get_image(ImageFile(file_=fp))),
                (75, 75))
Example #2
0
    def test_retina(self):
        get_thumbnail(self.im, '50x50')

        actions = [
            # save regular resolution, same as in StorageTestCase
            'open: retina.jpg',
            'save: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
            'get_available_name: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
            'exists: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',

            # save the 1.5x resolution version
            'save: test/cache/19/10/[email protected]',
            'get_available_name: test/cache/19/10/[email protected]',
            'exists: test/cache/19/10/[email protected]',

            # save the 2x resolution version
            'save: test/cache/19/10/[email protected]',
            'get_available_name: test/cache/19/10/[email protected]',
            'exists: test/cache/19/10/[email protected]'
        ]
        self.assertEqual(self.log, actions)

        with open(pjoin(settings.MEDIA_ROOT, 'test/cache/19/10/[email protected]')) as fp:
            engine = PILEngine()
            self.assertEqual(engine.get_image_size(engine.get_image(ImageFile(file_=fp))), (75, 75))
Example #3
0
    def test_retina(self):
        get_thumbnail(self.im, '50x50')

        actions = [
            'exists: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',

            # save regular resolution, same as in StorageTestCase
            'open: retina.jpg',
            'save: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
            'get_available_name: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
            'exists: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',

            # save the 1.5x resolution version
            'save: test/cache/19/10/[email protected]',
            'get_available_name: test/cache/19/10/[email protected]',
            'exists: test/cache/19/10/[email protected]',

            # save the 2x resolution version
            'save: test/cache/19/10/[email protected]',
            'get_available_name: test/cache/19/10/[email protected]',
            'exists: test/cache/19/10/[email protected]'
        ]
        self.assertEqual(self.log, actions)

        p = pjoin(
            settings.MEDIA_ROOT,
            'test/cache/19/10/[email protected]')
        with open(p) as fp:
            engine = PILEngine()
            self.assertEqual(
                engine.get_image_size(engine.get_image(ImageFile(file_=fp))),
                (75, 75))
    def test_retina(self):
        get_thumbnail(self.image, '50x50')

        actions = [
            'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',

            # save regular resolution, same as in StorageTestCase
            'open: retina.jpg',
            'save: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
            'get_available_name: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
            'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',

            # save the 1.5x resolution version
            'save: test/cache/91/bb/[email protected]',
            'get_available_name: test/cache/91/bb/[email protected]',
            'exists: test/cache/91/bb/[email protected]',

            # save the 2x resolution version
            'save: test/cache/91/bb/[email protected]',
            'get_available_name: test/cache/91/bb/[email protected]',
            'exists: test/cache/91/bb/[email protected]'
        ]
        self.assertEqual(self.log, actions)

        path = os.path.join(settings.MEDIA_ROOT,
                            'test/cache/91/bb/[email protected]')

        with open(path) as fp:
            engine = PILEngine()
            self.assertEqual(engine.get_image_size(engine.get_image(ImageFile(file_=fp))), (75, 75))