Commit 8623565d authored by Jérome Perrin's avatar Jérome Perrin

add a test to make sure renaming categories works.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3536 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da1a7e9e
......@@ -363,6 +363,34 @@ class TestCMFCategory(ERP5TypeTestCase):
self.assertEqual(len(o1.getGenderRelatedValueList()),2)
def test_13_RenameCategory(self, quiet=0, run=run_all_test) :
if not run: return
if not quiet:
ZopeTestCase._print('\n Test Category Renaming')
LOG('Testing... ',0,'Category Renaming')
portal = self.getPortal()
france = portal.portal_categories.resolveCategory('region/europe/west/france')
self.assertNotEqual(france, None)
p1 = self.getPersonModule()._getOb(self.id1)
p1.setRegion('europe/west/france')
p1.immediateReindexObject()
self.tic()
west = portal.portal_categories.resolveCategory('region/europe/west')
# To be able to change the object id, we must first commit the transaction,
# because in Zope we are not able to create an object and modify its id
# in the same transaction
get_transaction().commit()
west.setId("ouest")
west.immediateReindexObject()
self.tic()
self.assertEqual(west,
portal.portal_categories.resolveCategory('region/europe/ouest'))
self.assertEqual(p1.getRegion(), 'europe/ouest/france')
self.assertTrue(p1 in west.getRegionRelatedValueList())
if __name__ == '__main__':
framework()
......
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