def test_should_parse_background_color_with_valid_value(self): optimizer = Optimizer(self.get_context()) magenta_unicode_hex = u'#ff00ff' self.assertEqual(optimizer.normalize_color_to_hex('ff00ff'), magenta_unicode_hex) self.assertEqual(optimizer.normalize_color_to_hex('#ff00ff'), magenta_unicode_hex) self.assertEqual(optimizer.normalize_color_to_hex('f0f'), magenta_unicode_hex) self.assertEqual(optimizer.normalize_color_to_hex('#f0f'), magenta_unicode_hex) self.assertEqual(optimizer.normalize_color_to_hex('magenta'), magenta_unicode_hex)
def test_should_not_parse_background_color_with_invalid_value(self): optimizer = Optimizer(self.get_context()) self.assertEqual(optimizer.normalize_color_to_hex('asdfasdfasfd'), None)
def test_should_not_run_for_not_gif(self): optimizer = Optimizer(self.get_context()) for ext in EXTENSION.itervalues(): if ext != '.gif': self.assertFalse(optimizer.should_run(ext, ''))
def test_should_run_for_gif(self): optimizer = Optimizer(self.get_context()) self.assertTrue(optimizer.should_run('.gif', ''))
def test_should_not_parse_background_color_with_invalid_value(self): optimizer = Optimizer(self.get_context()) self.assertEqual(optimizer.normalize_color_to_hex("asdfasdfasfd"), None)
def test_should_not_run_if_binary_ffmpeg_path_does_not_exist(self): self.mock_os_path_exists.return_value = False optimizer = Optimizer(self.get_context()) self.assertFalse(optimizer.should_run(".gif", ""))
def test_should_not_run_for_not_gif(self): optimizer = Optimizer(self.get_context()) for ext in EXTENSION.items(): if ext != ".gif": self.assertFalse(optimizer.should_run(ext, ""))
def test_should_run_for_gif(self): optimizer = Optimizer(self.get_context()) self.assertTrue(optimizer.should_run(".gif", ""))
def test_should_not_run_if_binary_ffmpeg_path_does_not_exist(self): self.mock_os_path_exists.return_value = False optimizer = Optimizer(self.get_context()) self.assertFalse(optimizer.should_run('.gif', ''))