This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/tests/test_jinja.py

28 lines
801 B
Python
Raw Permalink Normal View History

from tests import BaseTestCase
from md_pdf.build.jinja import render_content
class ContentRendererTestCase(BaseTestCase):
def test_renders_template(self):
html = 'test {{ test }}'
output = render_content(html, self.extend_config({
'test': 'content'
}))
self.assertEqual(output, 'test content')
def test_changes_nothing(self):
html = 'test test'
output = render_content(html, self.extend_config({
'test': 'content'
}))
self.assertEqual(output, html)
def test_with_block(self):
html = """
{% with test = 'test' %}
{{ test }} thing
{% endwith %}
"""
output = render_content(html, self.BASE_VALID_CONFIG)
self.assertIn('test thing', output)