bug 999371, add a simple test case to test the tag

add name and contact info to AUTHORS file. Change Author in the commit
message, add email to .mailmap

Change-Id: Ic9aba5dfde0aae0faee6b944d253cd3d9d8ea4e7
This commit is contained in:
Ke Wu 2012-05-17 00:17:31 -07:00 committed by Ke Wu
parent 0d8273463d
commit d958f82bb8
4 changed files with 19 additions and 3 deletions

View File

@ -6,3 +6,4 @@
<launchpad@markgius.com> <mgius7096@gmail.com>
<yorik.sar@gmail.com> <yorik@ytaraday>
<jeblair@hp.com> <james.blair@rackspace.com>
<ke.wu@ibeca.me> <ke.wu@nebula.com>

View File

@ -32,6 +32,7 @@ John Postlethwait <john.postlethwait@nebula.com>
Joseph Heck <heckj@mac.com>
Joshua McKenty <joshua@pistoncloud.com>
Julien Danjou <julien.danjou@enovance.com>
Ke Wu <ke.wu@ibeca.me>
Ken Pepple <ken.pepple@gmail.com>
Mark Gius <launchpad@markgius.com>
Michael Szilagyi <mszilagyi@gmail.com>

View File

@ -1,7 +1,7 @@
{% load horizon i18n %}
{% load branding horizon i18n %}
<div class='sidebar'>
<h1 class="brand clearfix"><a href="{% url horizon:user_home %}">{% trans "OpenStack Dashboard" %}</a></h1>
<h1 class="brand clearfix"><a href="{% url horizon:user_home %}">{% site_branding %}</a></h1>
{% horizon_main_nav %}

View File

@ -23,6 +23,9 @@ import re
from django.utils.text import normalize_newlines
from horizon import test
from horizon.templatetags import branding
from django.template import Context, Template
from django.conf import settings
def single_line(text):
@ -33,4 +36,15 @@ def single_line(text):
class TemplateTagTests(test.TestCase):
pass
'''Test Custom Template Tag'''
def render_template_tag(self, tag_name, tag_require=''):
'''Render a Custom Template Tag to string'''
template = Template("{%% load %s %%}{%% %s %%}"
% (tag_require, tag_name))
return template.render(Context())
def test_site_branding_tag(self):
'''Test if site_branding tag renders the correct setting'''
rendered_str = self.render_template_tag("site_branding", "branding")
self.assertEqual(settings.SITE_BRANDING, rendered_str.strip(),
"tag site_branding renders %s" % rendered_str.strip())