Beispiel #1
0
 def test_get_parent_badges_no_hierarchy(self):
     from adhocracy.model import UserBadge
     from adhocracy.lib.helpers.badge_helper import get_parent_badges
     badge = UserBadge.create(u'testbadge', u'#ccc', True, u'description')
     result = [b.title for b in get_parent_badges(badge)]
     shouldbe = []
     self.assertEqual(result, shouldbe)
Beispiel #2
0
 def test_get_parent_badges_no_hierarchy(self):
     from adhocracy.model import UserBadge
     from adhocracy.lib.helpers.badge_helper import get_parent_badges
     badge = UserBadge.create(u'testbadge', u'#ccc', True, u'description')
     result = [b.title for b in get_parent_badges(badge)]
     shouldbe = []
     self.assertEqual(result, shouldbe)
Beispiel #3
0
 def test_get_parent_badges_with_hierarchy(self):
     from adhocracy.model import CategoryBadge
     from adhocracy.lib.helpers.badge_helper import get_parent_badges
     badge0 = CategoryBadge.create('testbadge0', '#ccc', True, 'descr')
     badge11 = CategoryBadge.create('testbadge11', '#ccc', True, 'descr')
     badge12 = CategoryBadge.create('testbadge12', '#ccc', True, 'descr')
     badge121 = CategoryBadge.create('testbadge121', '#ccc', True, 'descr')
     badge11.parent = badge0
     badge12.parent = badge0
     badge121.parent = badge12
     result = [b.title for b in get_parent_badges(badge121)]
     shouldbe = ['testbadge12', 'testbadge0']
     self.assertEqual(result, shouldbe)
Beispiel #4
0
 def test_get_parent_badges_with_hierarchy(self):
     from adhocracy.model import CategoryBadge
     from adhocracy.lib.helpers.badge_helper import get_parent_badges
     badge0 = CategoryBadge.create(u'testbadge0', u'#ccc', True, u'descr')
     badge11 = CategoryBadge.create(u'testbadge11', u'#ccc', True, u'descr')
     badge12 = CategoryBadge.create(u'testbadge12', u'#ccc', True, u'descr')
     badge121 = CategoryBadge.create(u'testbadge121', u'#ccc', True,
                                     u'descr')
     badge11.parent = badge0
     badge12.parent = badge0
     badge121.parent = badge12
     result = [b.title for b in get_parent_badges(badge121)]
     shouldbe = ['testbadge12', u'testbadge0']
     self.assertEqual(result, shouldbe)