diff --git a/compressor/test_settings.py b/compressor/test_settings.py index b14899d..1fa4ad9 100644 --- a/compressor/test_settings.py +++ b/compressor/test_settings.py @@ -21,6 +21,8 @@ INSTALLED_APPS = [ ] MEDIA_URL = '/media/' +STATIC_URL = MEDIA_URL + MEDIA_ROOT = os.path.join(TEST_DIR, 'media') diff --git a/compressor/tests/__init__.py b/compressor/tests/__init__.py index 010d088..bc2c704 100644 --- a/compressor/tests/__init__.py +++ b/compressor/tests/__init__.py @@ -10,6 +10,7 @@ from compressor.tests.offline import ( OfflineGenerationBlockSuperMultipleTestCase, OfflineGenerationConditionTestCase, OfflineGenerationTemplateTagTestCase, + OfflineGenerationStaticTemplateTagTestCase, OfflineGenerationTestCaseWithContext, OfflineGenerationTestCaseErrors, OfflineGenerationTestCase, diff --git a/compressor/tests/offline.py b/compressor/tests/offline.py index 8de8593..65a1a5f 100644 --- a/compressor/tests/offline.py +++ b/compressor/tests/offline.py @@ -1,11 +1,13 @@ from __future__ import with_statement import os +from unittest2 import skipIf try: from cStringIO import StringIO except ImportError: from StringIO import StringIO +import django from django.template import Template, Context from django.test import TestCase from django.core.management.base import CommandError @@ -110,6 +112,14 @@ class OfflineGenerationTemplateTagTestCase(OfflineTestCaseMixin, TestCase): expected_hash = "a27e1d3a619a" +class OfflineGenerationStaticTemplateTagTestCase(OfflineTestCaseMixin, TestCase): + templates_dir = "test_static_templatetag" + expected_hash = "dfa2bb387fa8" +# This test uses {% static %} which was introduced in django 1.4 +OfflineGenerationStaticTemplateTagTestCase = skipIf( + django.VERSION[1] < 4, 'Django 1.4 not found') (OfflineGenerationStaticTemplateTagTestCase) + + class OfflineGenerationTestCaseWithContext(OfflineTestCaseMixin, TestCase): templates_dir = "test_with_context" expected_hash = "5838e2fd66af" diff --git a/compressor/tests/test_templates/test_static_templatetag/test_compressor_offline.html b/compressor/tests/test_templates/test_static_templatetag/test_compressor_offline.html new file mode 100644 index 0000000..8e17d32 --- /dev/null +++ b/compressor/tests/test_templates/test_static_templatetag/test_compressor_offline.html @@ -0,0 +1,6 @@ +{% load compress static %}{% spaceless %} + +{% compress js %} + + +{% endcompress %}{% endspaceless %}