From 2a1a7a43b603efdbfd26c5a85218da4b7602914e Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Tue, 21 May 2024 16:36:03 -0600 Subject: [PATCH] Made the tests more thorough --- tests/testproject/templates/base.html | 1 + tests/testproject/templates/test.html | 26 +++++++++++++++----------- tests/testproject/tests.py | 7 ++++++- 3 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 tests/testproject/templates/base.html diff --git a/tests/testproject/templates/base.html b/tests/testproject/templates/base.html new file mode 100644 index 0000000..116eee1 --- /dev/null +++ b/tests/testproject/templates/base.html @@ -0,0 +1 @@ +{% block content %}{% endblock content %} \ No newline at end of file diff --git a/tests/testproject/templates/test.html b/tests/testproject/templates/test.html index 7991bb0..0f8f7a6 100644 --- a/tests/testproject/templates/test.html +++ b/tests/testproject/templates/test.html @@ -1,27 +1,31 @@ +{% extends "base.html" %} + {% load friendly_loader %} {% friendly_load error_tags %} {% friendly_load webdesign %} -{% if_has_tag lorem %} +{% block content %} + {% if_has_tag lorem %}

SUCCESS

{% lorem %} -{% else %} + {% else %}

FAIL

-{% endif_has_tag %} + {% endif_has_tag %} -{% if_has_tag fail %} + {% if_has_tag fail %}

FAIL

{% fail %} -{% else %} + {% else %}

SUCCESS

-{% endif_has_tag %} + {% endif_has_tag %} -{% ifnot_has_tag now nonexisting_tag %} + {% ifnot_has_tag now nonexisting_tag %} {% now "Y" %} -{% endifnot_has_tag %} + {% endifnot_has_tag %} -{% if_has_tag now %} + {% if_has_tag now %} {% now "Y" %} -{% else %} + {% else %} FAIL -{% endif_has_tag %} + {% endif_has_tag %} +{% endblock content %} diff --git a/tests/testproject/tests.py b/tests/testproject/tests.py index 6284164..ace9ae2 100644 --- a/tests/testproject/tests.py +++ b/tests/testproject/tests.py @@ -8,7 +8,12 @@ def _render_template(template): - return Template(template).render(Context({})).strip() + return Template( + '{% extends "base.html" %}' + + '{% block content %}' + + template + + '{% endblock content %}' + ).render(Context({})).strip() class FriendlyLoadingTest(TestCase):