Commit 0480dd10 authored by Vincent Pelletier's avatar Vincent Pelletier

testCMFCategory: Simplify test_09_GetCategoryParentUidList

Drop overly descriptive comments.
Simplify code.
Fix coding style.
parent a2c7ef15
...@@ -314,27 +314,22 @@ class TestCMFCategory(ERP5TypeTestCase): ...@@ -314,27 +314,22 @@ class TestCMFCategory(ERP5TypeTestCase):
def test_09_GetCategoryParentUidList(self): def test_09_GetCategoryParentUidList(self):
# Test if an infinite loop of the acquisition for a single value is working # Test if an infinite loop of the acquisition for a single value is working
# WARNING: getCategoryParentUidList does not provide a sorted result
portal_categories = self.getCategoriesTool() portal_categories = self.getCategoriesTool()
# Create a base category basecat getCategoryParentUidList = portal_categories.getCategoryParentUidList
#portal_categories.manage_addProduct['ERP5'].addBaseCategory('basecat') basecat = portal_categories.newContent(portal_type='Base Category', id='basecat')
portal_categories.newContent(portal_type='Base Category',id='basecat') cat1 = basecat.newContent(portal_type='Category', id='cat1')
# Create a category cat1 at basecate cat2 = cat1.newContent(portal_type='Category', id='cat2')
portal_categories.basecat.newContent(id='cat1',portal_type='Category') cat22 = cat2.newContent(portal_type='Category', id='cat2')
basecat = portal_categories.basecat self.assertItemsEqual(
cat1 = portal_categories.basecat.cat1 getCategoryParentUidList(
# Create a category cat2 at cat1 relative_url=cat2.getRelativeUrl(),
portal_categories.basecat.cat1.newContent(portal_type='Category',id='cat2') ),
cat2 = portal_categories.basecat.cat1.cat2 [
cat2.newContent(id='cat2',portal_type='Category') (cat2.getUid(), basecat.getUid(), 1),
# Compare result after sorting it (cat1.getUid(), basecat.getUid(), 0),
parent_uid_list = [(cat2.getUid(), basecat.getUid(), 1), (basecat.getUid(), basecat.getUid(), 0),
(cat1.getUid(), basecat.getUid(), 0), ],
(basecat.getUid(), basecat.getUid(), 0)] )
parent_uid_list.sort()
parent_uid_list2 = cat2.getCategoryParentUidList(relative_url = cat2.getRelativeUrl())
parent_uid_list2.sort()
self.assertEqual(parent_uid_list2, parent_uid_list)
def test_10_FallBackBaseCategory(self): def test_10_FallBackBaseCategory(self):
# Test if we can use an alternative base category # Test if we can use an alternative base category
......
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