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")
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)
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')
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)
def setUp(self): self.minifier = Minifier() self.resource = Resource('path/to/some/file')