Add tests regarding the use of {% static %} in django-1.4 and compressor
Conflicts: compressor/tests/__init__.py
This commit is contained in:

committed by
Jannis Leidel

parent
bf2f7deaaa
commit
2633b62e17
@@ -21,6 +21,8 @@ INSTALLED_APPS = [
|
||||
]
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
STATIC_URL = MEDIA_URL
|
||||
|
||||
|
||||
MEDIA_ROOT = os.path.join(TEST_DIR, 'media')
|
||||
|
||||
|
@@ -10,6 +10,7 @@ from compressor.tests.offline import (
|
||||
OfflineGenerationBlockSuperMultipleTestCase,
|
||||
OfflineGenerationConditionTestCase,
|
||||
OfflineGenerationTemplateTagTestCase,
|
||||
OfflineGenerationStaticTemplateTagTestCase,
|
||||
OfflineGenerationTestCaseWithContext,
|
||||
OfflineGenerationTestCaseErrors,
|
||||
OfflineGenerationTestCase,
|
||||
|
@@ -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"
|
||||
|
@@ -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 %}
|
Reference in New Issue
Block a user