diff options
author | 2019-04-19 15:20:06 +0100 | |
---|---|---|
committer | 2019-04-19 15:20:06 +0100 | |
commit | 4664d705f2fcb3d152408cbf3915044d193d38dc (patch) | |
tree | 58d94ff414f3e59e69e2f36f5ab377f1d3bc6b64 /pydis_site/apps/home | |
parent | First testing attempt (diff) |
Wiki requires notification plugin, so we're stuck with it
Diffstat (limited to 'pydis_site/apps/home')
-rw-r--r-- | pydis_site/apps/home/tests/test_wiki_templatetags.py | 24 |
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(), "/") |