Files
deb-python-django-pyscss/tests/test_compressor.py
Rocky Meza 53d023e453 Reworked the relative/absolute import system.
Now, it works more like HTML URL resolution, where any URL is relative
unless it starts with a /.
2014-02-03 17:54:27 -07:00

32 lines
905 B
Python

from django.test import TestCase
from django.template.loader import Template, Context
APP2_LINK_TAG = """
{% load staticfiles compress %}
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static 'css/app2.scss' %}">
{% endcompress %}
"""
IMPORT_APP2_STYLE_TAG = """
{% load staticfiles compress %}
{% compress css %}
<style type="text/x-scss">
@import "css/app2.scss";
</style>
{% endcompress %}
"""
class CompressorTest(TestCase):
def test_compressor_can_compile_scss(self):
actual = Template(APP2_LINK_TAG).render(Context())
# 4b368862ec8c is the cache key that compressor gives to the compiled
# version of app2.scss.
self.assertIn('4b368862ec8c.css', actual)
def test_compressor_can_compile_scss_from_style_tag(self):
actual = Template(IMPORT_APP2_STYLE_TAG).render(Context())
self.assertIn('4b368862ec8c.css', actual)