def test_optipng_should_optimize_png(self):
        optimizer = OptipngOptimizer(self.get_context())
        temp = tempfile.NamedTemporaryFile()
        optimizer.optimize(None, fixtures_folder + '/img/bend.png', temp.name)

        self.assertLessEqual(os.path.getsize(temp.name), os.path.getsize(fixtures_folder + '/img/bend.png'),
                             "optipng could not lower filesize for img/bend.png")
Пример #2
0
    def test_optipng_should_optimize_png(self):
        optimizer = OptipngOptimizer(self.get_context())
        temp = tempfile.NamedTemporaryFile()
        optimizer.optimize(None, fixtures_folder + '/img/bend.png', temp.name)

        self.assertLessEqual(os.path.getsize(temp.name), os.path.getsize(fixtures_folder + '/img/bend.png'),
                             "optipng could not lower filesize for img/bend.png")
 def test_optiping_should_fix_image(self):
     optimizer = OptipngOptimizer(self.get_context())
     temp = tempfile.NamedTemporaryFile()
     optimizer.optimize(None, fixtures_folder + '/img/optipng-fix-needed.png', temp.name)
     
     self.assertLessEqual(os.path.getsize(fixtures_folder +'/img/optipng-fix-needed.png'),
                          os.path.getsize(temp.name), "optipng did not fix the broken image")