--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -1,5 +1,7 @@
import re
from urllib import quote
+
+from bson import ObjectId
from nose.tools import with_setup, assert_equal
from pylons import g, c
@@ -243,6 +245,31 @@
proj_title = '<h2><a href="%s">%s</a></h2>' % (p.url(), p.name)
assert proj_title in r
+@with_setup(setUp)
+def test_hideawards_macro():
+ p_nbhd = M.Neighborhood.query.get(name='Projects')
+
+ app_config_id = ObjectId()
+ tool_version = {'neighborhood': '0'}
+ award = M.Award(app_config_id=app_config_id, tool_version=tool_version)
+ award.short = u'Award short'
+ award.full = u'Award full'
+ award.created_by_neighborhood_id = p_nbhd._id
+
+ project = M.Project.query.get(neighborhood_id=p_nbhd._id, name=u'test')
+
+ award_grant = M.AwardGrant(award=award,
+ granted_by_neighborhood=p_nbhd,
+ granted_to_project=project)
+
+ ThreadLocalORMSession.flush_all()
+
+ with h.push_context(p_nbhd.neighborhood_project._id):
+ r = g.markdown_wiki.convert('[[projects]]')
+ assert '<div class="feature">Award short</div>' in r
+ r = g.markdown_wiki.convert('[[projects show_awards_banner=False]]')
+ assert '<div class="feature">Award short</div>' not in r
+
def get_project_names(r):
"""
Extracts a list of project names from a wiki page HTML.