Regression test for #718

This commit is contained in:
Yuri Prezument
2016-01-19 16:41:37 +02:00
parent 2ff63b20bd
commit c5bff951b1
3 changed files with 31 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ from unittest import SkipTest
from django.core.management.base import CommandError
from django.template import Template, Context
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from compressor.cache import flush_offline_manifest, get_offline_manifest
@@ -629,3 +630,26 @@ class OfflineCompressComplexTestCase(OfflineTestCaseMixin, TestCase):
rendered_template = self._render_template(engine)
result = (result[0], result[2])
self.assertEqual(rendered_template, ''.join(result) + '\n')
class OfflineCompressExtendsRecursionTestCase(OfflineTestCaseMixin, TestCase):
"""
Test that templates extending templates with the same name
(e.g. admin/index.html) don't cause an infinite test_extends_recursion
"""
templates_dir = 'test_extends_recursion'
engines = ('django',)
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'compressor',
]
@override_settings(INSTALLED_APPS=INSTALLED_APPS)
def _test_offline(self, engine):
count, result = CompressCommand().compress(
log=self.log, verbosity=self.verbosity, engine=engine)
self.assertEqual(count, 1)

View File

@@ -0,0 +1 @@
{% extends "admin/index.html" %}

View File

@@ -0,0 +1,6 @@
{% load compress %}
{% compress js%}
<script type="text/javascript">alert('test');</script>
{% endcompress %}
{# The real error is caused by "admin/index.html" #}