Test that exception is raised for nonexistent precompiler
If the class provided to `COMPRESS_PRECOMPILERS` doesn't exist (but its module does), an exception should be raised.
This commit is contained in:
committed by
Antti Hirvonen
parent
0dd900736c
commit
19ccaaf905
@@ -11,6 +11,7 @@ from compressor.base import SOURCE_HUNK, SOURCE_FILE
|
||||
from compressor.conf import settings
|
||||
from compressor.css import CssCompressor
|
||||
from compressor.js import JsCompressor
|
||||
from compressor.exceptions import FilterDoesNotExist
|
||||
|
||||
|
||||
def css_tag(href, **kwargs):
|
||||
@@ -155,6 +156,17 @@ class CompressorTestCase(TestCase):
|
||||
self.assertEqual(output.text, 'OUTPUT')
|
||||
settings.COMPRESS_PRECOMPILERS = original_precompilers
|
||||
|
||||
def test_nonexistent_precompiler_error(self):
|
||||
original_precompilers = settings.COMPRESS_PRECOMPILERS
|
||||
settings.COMPRESS_ENABLED = True
|
||||
settings.COMPRESS_PRECOMPILERS = (
|
||||
('text/foobar', 'compressor.tests.base.NonexistentFilter'),
|
||||
)
|
||||
css = '<style type="text/foobar">p { border:10px solid red;}</style>'
|
||||
css_node = CssCompressor(css)
|
||||
self.assertRaises(FilterDoesNotExist, css_node.output, 'inline')
|
||||
settings.COMPRESS_PRECOMPILERS = original_precompilers
|
||||
|
||||
|
||||
class CssMediaTestCase(TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user