Exemplo n.º 1
0
    def test_generate_pngquant_called(self, pngquant_mock):
        image = ImageModelFactory.create(file__filename='test.png')
        thumbnail = Thumbnail(image.file.path, {
            'size': ['50', '50'],
            'pngquant': '50'
        })

        assert thumbnail.generate() is True
        assert pngquant_mock.called is True
Exemplo n.º 2
0
 def test_exists(self):
     image = ImageModelFactory.create()
     thumbnail = Thumbnail(image.file.path, {'size': ['50', '50']})
     assert thumbnail.exists() is False
     thumbnail.generate()
     assert thumbnail.exists() is True
 def test_exists(self):
     image = ImageModelFactory.create()
     thumbnail = Thumbnail(image.file.path, {'size': ['50', '50']})
     assert thumbnail.exists() is False
     thumbnail.generate()
     assert thumbnail.exists() is True
Exemplo n.º 4
0
    def test_generate_pngquant_disabled(self, pngquant_mock):
        image = ImageModelFactory.create()
        thumbnail = Thumbnail(image.file.path, {'size': ['50', '50']})

        assert thumbnail.generate() is True
        assert pngquant_mock.called is False
    def test_generate_pngquant_no_png(self, pngquant_mock):
        image = ImageModelFactory.create()
        thumbnail = Thumbnail(image.file.path, {'size': ['50', '50'], 'pngquant': '50'})

        assert thumbnail.generate() is True
        assert pngquant_mock.called is False