From 4664d705f2fcb3d152408cbf3915044d193d38dc Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Fri, 19 Apr 2019 15:20:06 +0100 Subject: Wiki requires notification plugin, so we're stuck with it --- .../apps/home/tests/test_wiki_templatetags.py | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'pydis_site/apps/home') 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(), "/") -- cgit v1.2.3