Commit eedb2b29 authored by Alexandre Boeglin's avatar Alexandre Boeglin

check that getCategoryList called on a category does not append self if

already included.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9997 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f468a891
......@@ -1150,6 +1150,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
else:
result = []
if getattr(context, 'isCategory', 0):
category_url = context.getRelativeUrl()
if category_url not in result:
result.append(context.getRelativeUrl()) # Pure category is member of itself
return result
......
......@@ -595,6 +595,22 @@ class TestCMFCategory(ERP5TypeTestCase):
self.tic()
self.assert_(obj in [x.getObject() for x in test.getCategoryMemberValueList()])
def test_18_getCategoryList(self, quiet=0, run=run_all_test):
"""
check that getCategoryList called on a category does not append self again
and again
"""
if not run: return
if not quiet:
message = 'Test getCategoryList on Category'
ZopeTestCase._print('\n ' + message)
LOG('Testing... ', 0, message)
portal = self.getPortal()
region_value = portal.portal_categories.resolveCategory('region/%s' % self.region1)
category_list = region_value.getCategoryList()
region_value.setCategoryList(category_list)
self.assertEqual(category_list, region_value.getCategoryList())
if __name__ == '__main__':
framework()
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment