Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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, ''))
Example #5
0
 def test_should_run_for_gif(self):
     optimizer = Optimizer(self.get_context())
     self.assertTrue(optimizer.should_run('.gif', ''))
Example #6
0
 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)
Example #7
0
    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", ""))
Example #8
0
 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, ""))
Example #9
0
 def test_should_run_for_gif(self):
     optimizer = Optimizer(self.get_context())
     self.assertTrue(optimizer.should_run(".gif", ""))
Example #10
0
    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', ''))
Example #11
0
 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, ''))