Test that precompiler classes are used
This commit is contained in:
committed by
Antti Hirvonen
parent
d0c64e387a
commit
7448bae42b
@@ -19,6 +19,15 @@ def css_tag(href, **kwargs):
|
|||||||
return template % (href, rendered_attrs)
|
return template % (href, rendered_attrs)
|
||||||
|
|
||||||
|
|
||||||
|
class TestPrecompiler(object):
|
||||||
|
"""A filter whose output is always the string 'OUTPUT' """
|
||||||
|
def __init__(self, content, filter_type=None, filename=None):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def input(self, **kwargs):
|
||||||
|
return 'OUTPUT'
|
||||||
|
|
||||||
|
|
||||||
test_dir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
|
test_dir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
|
||||||
|
|
||||||
|
|
||||||
@@ -134,6 +143,18 @@ class CompressorTestCase(TestCase):
|
|||||||
finally:
|
finally:
|
||||||
settings.COMPRESS_OUTPUT_DIR = old_output_dir
|
settings.COMPRESS_OUTPUT_DIR = old_output_dir
|
||||||
|
|
||||||
|
def test_precompiler_class_used(self):
|
||||||
|
original_precompilers = settings.COMPRESS_PRECOMPILERS
|
||||||
|
settings.COMPRESS_ENABLED = True
|
||||||
|
settings.COMPRESS_PRECOMPILERS = (
|
||||||
|
('text/foobar', 'compressor.tests.base.TestPrecompiler'),
|
||||||
|
)
|
||||||
|
css = '<style type="text/foobar">p { border:10px solid red;}</style>'
|
||||||
|
css_node = CssCompressor(css)
|
||||||
|
output = BeautifulSoup(css_node.output('inline'))
|
||||||
|
self.assertEqual(output.text, 'OUTPUT')
|
||||||
|
settings.COMPRESS_PRECOMPILERS = original_precompilers
|
||||||
|
|
||||||
|
|
||||||
class CssMediaTestCase(TestCase):
|
class CssMediaTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user