Add tests regarding the use of {% static %} in django-1.4 and compressor

Conflicts:

	compressor/tests/__init__.py
This commit is contained in:
Mathieu Pillard
2012-03-16 18:26:11 +01:00
committed by Jannis Leidel
parent bf2f7deaaa
commit 2633b62e17
4 changed files with 19 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ INSTALLED_APPS = [
] ]
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
STATIC_URL = MEDIA_URL
MEDIA_ROOT = os.path.join(TEST_DIR, 'media') MEDIA_ROOT = os.path.join(TEST_DIR, 'media')

View File

@@ -10,6 +10,7 @@ from compressor.tests.offline import (
OfflineGenerationBlockSuperMultipleTestCase, OfflineGenerationBlockSuperMultipleTestCase,
OfflineGenerationConditionTestCase, OfflineGenerationConditionTestCase,
OfflineGenerationTemplateTagTestCase, OfflineGenerationTemplateTagTestCase,
OfflineGenerationStaticTemplateTagTestCase,
OfflineGenerationTestCaseWithContext, OfflineGenerationTestCaseWithContext,
OfflineGenerationTestCaseErrors, OfflineGenerationTestCaseErrors,
OfflineGenerationTestCase, OfflineGenerationTestCase,

View File

@@ -1,11 +1,13 @@
from __future__ import with_statement from __future__ import with_statement
import os import os
from unittest2 import skipIf
try: try:
from cStringIO import StringIO from cStringIO import StringIO
except ImportError: except ImportError:
from StringIO import StringIO from StringIO import StringIO
import django
from django.template import Template, Context from django.template import Template, Context
from django.test import TestCase from django.test import TestCase
from django.core.management.base import CommandError from django.core.management.base import CommandError
@@ -110,6 +112,14 @@ class OfflineGenerationTemplateTagTestCase(OfflineTestCaseMixin, TestCase):
expected_hash = "a27e1d3a619a" 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): class OfflineGenerationTestCaseWithContext(OfflineTestCaseMixin, TestCase):
templates_dir = "test_with_context" templates_dir = "test_with_context"
expected_hash = "5838e2fd66af" expected_hash = "5838e2fd66af"

View File

@@ -0,0 +1,6 @@
{% load compress static %}{% spaceless %}
{% compress js %}
<script>alert('amazing');</script>
<script type="text/javascript" src="{% static "js/one.js" %}"></script>
{% endcompress %}{% endspaceless %}