aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/home/tests/test_wiki_templatetags.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/pydis_site/apps/home/tests/test_wiki_templatetags.py b/pydis_site/apps/home/tests/test_wiki_templatetags.py
index af85339f..5cd673bf 100644
--- a/pydis_site/apps/home/tests/test_wiki_templatetags.py
+++ b/pydis_site/apps/home/tests/test_wiki_templatetags.py
@@ -1,7 +1,7 @@
from unittest.mock import Mock
from django.test import TestCase
-from django.template import Template
+from django.template import Template, Context
from wiki.models import URLPath as _URLPath
@@ -17,23 +17,31 @@ class TestURLPathFilter(TestCase):
)
def test_str(self):
- context = {"obj": "path"}
- rendered = self.TEMPLATE.render(context)
+ context = {"obj": "/path/"}
+ rendered = self.TEMPLATE.render(Context(context))
+
+ self.assertEqual(rendered.strip(), "/path/")
def test_str_empty(self):
context = {"obj": ""}
- rendered = self.TEMPLATE.render(context)
+ rendered = self.TEMPLATE.render(Context(context))
+
+ self.assertEqual(rendered.strip(), "/")
def test_urlpath(self):
url_path = URLPath()
- url_path.path = None
+ url_path.path = "/path/"
context = {"obj": url_path}
- rendered = self.TEMPLATE.render(context)
+ rendered = self.TEMPLATE.render(Context(context))
+
+ self.assertEqual(rendered.strip(), "/path/")
def test_urlpath_root(self):
url_path = URLPath()
- url_path.path = "/path/"
+ url_path.path = None
context = {"obj": url_path}
- rendered = self.TEMPLATE.render(context)
+ rendered = self.TEMPLATE.render(Context(context))
+
+ self.assertEqual(rendered.strip(), "/")