Commit b7ac2edc by Timothée Peignier

improved tests

parent 2ef7581d
......@@ -24,9 +24,7 @@ class PipelineExtension(Extension):
package_name = parser.parse_expression().value
if tag.value == "compressed_css":
return nodes.Output([
self.call_method('package_css', args=[package_name]),
]).set_lineno(tag.lineno)
return self.package_css(package_name)
if tag.value == "compressed_js":
return nodes.Output([
......@@ -44,6 +42,7 @@ class PipelineExtension(Extension):
try:
package = packager.package_for('css', package_name)
except PackageNotFound:
return self.environment.get_template('pipeline/css.jinja').module
return nodes.Markup('')
if settings.PIPELINE:
......
# -*- coding: utf-8 flake8: noqa -*-
from .test_compiler import *
from .test_compressor import *
from .test_extension import *
from .test_glob import *
from .test_packager import *
from .test_storage import *
from .test_utils import *
from .test_utils import *
\ No newline at end of file
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from jinja2 import Environment, PackageLoader
from django.test import TestCase
from pipeline.jinja2.ext import PipelineExtension
class ExtensionTest(TestCase):
def setUp(self):
self.env = Environment(extensions=[PipelineExtension], loader=
PackageLoader('pipeline', 'templates'))
def test_no_package(self):
template = self.env.from_string(u"""{% compressed_css 'unknow' %}""")
self.assertEqual(u'', template.render(context))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment