Example #1
0
class TestMinifier(unittest.TestCase):
    def setUp(self):
        self.minifier = Minifier()
        self.resource = Resource('path/to/some/file')

    def tearDown(self):
        pass

    def test_has_a_minify_method_that_takes_a_resource(self):
        self.minifier.minify(self.resource)

    def test_has_a_minify_method_that_requires_a_resource_argument(self):
        self.assertRaises(Exception, self.minifier.minify, "some text")
Example #2
0
class TestMinifier(unittest.TestCase):

    def setUp(self):
        self.minifier = Minifier()
        self.resource = Resource('path/to/some/file')

    def tearDown(self):
        pass

    def test_has_a_minify_method_that_takes_a_resource(self):
        self.minifier.minify(self.resource)

    def test_has_a_minify_method_that_requires_a_resource_argument(self):
        self.assertRaises(Exception, self.minifier.minify, "some text")
Example #3
0
 def test_returns_none_when_asking_for_minifier_for_an_unknown_file_type(
         self):
     conf = Configuration()
     minifier = Minifier()
     conf.set_minifier_for_file_type(minifier, 'javascript')
     analyzers = conf.get_minifier_for_file_type('some-other-type')
     self.assertIsNone(analyzers)
Example #4
0
    def test_add_minifier_checks_classes(self):
        conf = Configuration()
        self.assertRaises(Exception, conf.set_minifier_for_file_type,
                          'string instead of an minifier', 'javascript')

        # should not throw
        conf.set_minifier_for_file_type(Minifier(), 'javascript')
        # should not throw
        conf.set_minifier_for_file_type(YUICompressorMinifier(), 'javascript')
Example #5
0
 def test_can_add_minifier_for_filetype(self):
     conf = Configuration()
     minifier = Minifier()
     conf.set_minifier_for_file_type(minifier, 'javascript')
     actual_minifier = conf.get_minifier_for_file_type('javascript')
     self.assertEqual(minifier, actual_minifier)
Example #6
0
 def setUp(self):
     self.minifier = Minifier()
     self.resource = Resource('path/to/some/file')
Example #7
0
 def setUp(self):
     self.minifier = Minifier()
     self.resource = Resource('path/to/some/file')