Added test for template tag and breadcrumb function.
This commit is contained in:
32
common/djangoapps/microsite_configuration/test_microsites.py
Normal file
32
common/djangoapps/microsite_configuration/test_microsites.py
Normal file
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user