def test_uppercase_rel(self): template = """{% load compress %}{% compress css %} <link rel="StyleSheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="StyleSheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/output.600674ea1d3d.css") self.assertEqual(out, render(template, self.context))
def test_nonascii_css_tag(self): template = self.env.from_string("""{% compress css -%} <link rel="stylesheet" href="{{ STATIC_URL }}css/nonasc.css" type="text/css" charset="utf-8"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %}""") context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/output.4263023f49d6.css") self.assertEqual(out, template.render(context))
def test_nonascii_css_tag(self): template = u"""{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ MEDIA_URL }}css/nonasc.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %} """ out = css_tag("/media/CACHE/css/799f6defe43c.css") self.assertEqual(out, render(template, self.context))
def test_uppercase_rel(self): template = u"""{% load compress %}{% compress css %} <link rel="StyleSheet" href="{{ MEDIA_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="StyleSheet" href="{{ MEDIA_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/media/CACHE/css/e41ba2cc6982.css") self.assertEqual(out, render(template, self.context))
def test_nonascii_css_tag(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/nonasc.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %} """ out = css_tag("/static/CACHE/css/output.d5444a1ab4a3.css") self.assertEqual(out, render(template, self.context))
def test_css_tag(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/58a8c0714e59.css") self.assertEqual(out, render(template, self.context))
def test_nonascii_css_tag(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/nonasc.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %} """ out = css_tag("/static/CACHE/css/799f6defe43c.css") self.assertEqual(out, render(template, self.context))
def test_css_tag(self): template = u"""{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ MEDIA_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ MEDIA_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/media/CACHE/css/e41ba2cc6982.css") self.assertEqual(out, render(template, self.context))
def test_uppercase_rel(self): template = """{% load compress %}{% compress css %} <link rel="StyleSheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="StyleSheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/e41ba2cc6982.css") self.assertEqual(out, render(template, self.context))
def test_nonascii_css_tag(self): template = self.env.from_string(u"""{% compress css -%} <link rel="stylesheet" href="{{ MEDIA_URL }}css/nonasc.css" type="text/css" charset="utf-8"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %}""") context = {'MEDIA_URL': settings.COMPRESS_URL} out = css_tag("/media/CACHE/css/799f6defe43c.css") self.assertEqual(out, template.render(context))
def test_nonascii_css_tag(self): template = self.env.from_string(u"""{% compress css -%} <link rel="stylesheet" href="{{ MEDIA_URL }}css/nonasc.css" type="text/css" charset="utf-8"> <style type="text/css">p { border:5px solid green;}</style> {% endcompress %}""") context = {'MEDIA_URL': settings.COMPRESS_URL} out = css_tag("/media/CACHE/css/799f6defe43c.css") self.assertEqual(out, template.render(context))
def test_css_tag(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/output.58a8c0714e59.css") self.assertEqual(out, render(template, self.context))
def test_css_tag_with_block(self): template = """{% load compress %}{% compress css file block_name %} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid blue;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/block_name.a1e074d0c4ac.css") self.assertEqual(out, render(template, self.context))
def test_css_tag(self): template = self.env.from_string("""{% compress css -%} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css" charset="utf-8"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css" charset="utf-8"> {% endcompress %}""") context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/e41ba2cc6982.css") self.assertEqual(out, template.render(context))
def test_css_tag(self): template = self.env.from_string("""{% compress css -%} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css" charset="utf-8"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css" charset="utf-8"> {% endcompress %}""") context = {"STATIC_URL": settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/58a8c0714e59.css") self.assertEqual(out, template.render(context))
def test_missing_rel_only_on_one_resource(self): template = """{% load compress %}{% compress css %} <link href="{{ STATIC_URL }}css/wontmatter.css" type="text/css"> <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid green;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %}""" out = css_tag("/static/CACHE/css/output.600674ea1d3d.css") self.assertEqual(out, render(template, self.context))
def test_nonascii_css_tag(self): template = self.template(self.wrap(''.join([ '<link rel="stylesheet" href="${ STATIC_URL }css/nonasc.css" ' 'type="text/css" charset="utf-8">', '<style type="text/css">p { border:5px solid green;}</style>', ]), 'css')) context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/4263023f49d6.css") self.assertEqual(out, template.render(**context))
def test_css_tag_with_storage(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid white;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %} """ context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/1d4424458f88.css") self.assertEqual(out, render(template, context))
def test_css_tag_with_storage(self): template = u"""{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ MEDIA_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid white;}</style> <link rel="stylesheet" href="{{ MEDIA_URL }}css/two.css" type="text/css"> {% endcompress %} """ context = {'MEDIA_URL': settings.COMPRESS_URL} out = css_tag("/media/CACHE/css/1d4424458f88.css") self.assertEqual(out, render(template, context))
def test_css_tag_with_storage(self): template = """{% load compress %}{% compress css %} <link rel="stylesheet" href="{{ STATIC_URL }}css/one.css" type="text/css"> <style type="text/css">p { border:5px solid white;}</style> <link rel="stylesheet" href="{{ STATIC_URL }}css/two.css" type="text/css"> {% endcompress %} """ context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/output.e701f86c6430.css") self.assertEqual(out, render(template, context))
def test_css_tag(self): template = self.template(self.wrap(''.join([ '<link rel="stylesheet" href="${ STATIC_URL }css/one.css" ' 'type="text/css" charset="utf-8">', '<style type="text/css">p { border:5px solid green;}</style>', '<link rel="stylesheet" href="${ STATIC_URL }css/two.css" ' 'type="text/css" charset="utf-8">', ]), 'compress kind="css"')) context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/58a8c0714e59.css") self.assertEqual(out, template.render(**context))