Skip to content

Commit

Permalink
Add another template test for 2nd snippet in README
Browse files Browse the repository at this point in the history
  • Loading branch information
bittner committed Jun 19, 2024
1 parent 714935a commit be3ae39
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.template import Context, Template

template = """
readme_template = """
{% load static %}
<head>
<link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
Expand All @@ -15,19 +15,35 @@
</body>
"""

classic_template = """
{% load static %}
<link rel="stylesheet" href="{% static 'fontawesome/css/all.min.css' %}">
"""


def test_template():
def test_readme_template():
"""Importing the package should work as described in the README."""
bootstrap_min_css = "bootstrap/css/bootstrap.min.css"
bootstrap_min_js = "bootstrap/js/bootstrap.bundle.min.js"
fontawesome_min_js = "fontawesome/js/all.min.js"
jquery_min_js = "bootstrap/js/jquery.min.js"

c = Context()
t = Template(template)
t = Template(readme_template)
html = t.render(c)

assert f'<link rel="stylesheet" href="/static/{bootstrap_min_css}">' in html
assert f'<script defer src="/static/{fontawesome_min_js}"></script>' in html
assert f'<script src="/static/{jquery_min_js}"></script>' in html
assert f'<script src="/static/{bootstrap_min_js}"></script>' in html


def test_classic_fontawesome():
"""Non-JS powered, classic Font Awesome."""
fontawesome_min_css = "fontawesome/css/all.min.css"

c = Context()
t = Template(classic_template)
html = t.render(c)

assert f'<link rel="stylesheet" href="/static/{fontawesome_min_css}">' in html

0 comments on commit be3ae39

Please sign in to comment.