From cb7882e0c87194bb12e35e7d9492cba900f00fce Mon Sep 17 00:00:00 2001 From: "Dave St.Germain" Date: Mon, 3 Feb 2014 11:22:49 -0500 Subject: [PATCH] Added test for template tag and breadcrumb function. --- .../test_microsites.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 common/djangoapps/microsite_configuration/test_microsites.py diff --git a/common/djangoapps/microsite_configuration/test_microsites.py b/common/djangoapps/microsite_configuration/test_microsites.py new file mode 100644 index 0000000000..b3bb21990a --- /dev/null +++ b/common/djangoapps/microsite_configuration/test_microsites.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +""" +Tests microsite_configuration templatetags and helper functions. +""" +from django.test import TestCase +from django.conf import settings +from .templatetags import microsite + + +class MicroSiteTests(TestCase): + def test_breadcrumbs(self): + crumbs = ['my', 'less specific', 'Page'] + expected = u'my | less specific | Page | edX' + title = microsite.page_title_breadcrumbs(*crumbs) + self.assertEqual(expected, title) + + def test_unicode_title(self): + crumbs = [u'øo', u'π tastes gréât', u'驴'] + expected = u'øo | π tastes gréât | 驴 | edX' + title = microsite.page_title_breadcrumbs(*crumbs) + self.assertEqual(expected, title) + + def test_platform_name(self): + pname = microsite.platform_name() + self.assertEqual(pname, settings.PLATFORM_NAME) + + def test_breadcrumb_tag(self): + crumbs = ['my', 'less specific', 'Page'] + expected = u'my | less specific | Page | edX' + title = microsite.page_title_breadcrumbs_tag(None, *crumbs) + self.assertEqual(expected, title) + \ No newline at end of file