added test_block_formatter; restructured workflows; added workflow badges
This commit is contained in:
1 parent
0b6a1b5d7a
commit
043b1e918f
6 files changed
+79
-37
No files matched your search
@@ -0,0 +1,20 @@
|
||||
from unittest import TestCase
|
||||
from bs4 import BeautifulSoup
|
||||
from html_to_django.formatters import block_formatter
|
||||
|
||||
|
||||
class BlockTests(TestCase):
|
||||
def test_basic(self):
|
||||
soup = BeautifulSoup('<div dj-block="content"></div>', "html.parser")
|
||||
block_formatter.format(soup)
|
||||
self.assertEqual("{% block content %}{% endblock %}", str(soup))
|
||||
|
||||
def test_with_content(self):
|
||||
soup = BeautifulSoup('<div dj-block="content">Test</div>', "html.parser")
|
||||
block_formatter.format(soup)
|
||||
self.assertEqual("{% block content %}Test{% endblock %}", str(soup))
|
||||
|
||||
def test_with_block_inside(self):
|
||||
soup = BeautifulSoup('<div dj-block="content"><div dj-block="inner">Test</div></div>', "html.parser")
|
||||
block_formatter.format(soup)
|
||||
self.assertEqual("{% block content %}{% block inner %}Test{% endblock %}{% endblock %}", str(soup))
|
||||
Reference in new issue
Block a user