[Erp5-report] r35480 luke - /erp5/trunk/products/ERP5Security/tests/testERP5Security.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 20 13:27:25 CEST 2010


Author: luke
Date: Thu May 20 13:27:21 2010
New Revision: 35480

URL: http://svn.erp5.org?rev=35480&view=rev
Log:
 - split to assert for roles on document and subdocuments acquiring local roles
Fix 35479 is not enough to refresh subdocuments

Modified:
    erp5/trunk/products/ERP5Security/tests/testERP5Security.py

Modified: erp5/trunk/products/ERP5Security/tests/testERP5Security.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Security/tests/testERP5Security.py?rev=35480&r1=35479&r2=35480&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Security/tests/testERP5Security.py [utf8] (original)
+++ erp5/trunk/products/ERP5Security/tests/testERP5Security.py [utf8] Thu May 20 13:27:21 2010
@@ -678,12 +678,43 @@
   def test_owner_local_role_on_clone(self):
     # check that tested stuff is ok
     parent_type = 'Person'
+    self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0)
+
+    original_owner_id = 'original_user' + self.id()
+    cloning_owner_id = 'cloning_user' + self.id()
+    self._createZodbUser(original_owner_id)
+    self._createZodbUser(cloning_owner_id)
+    transaction.commit()
+    module = self.portal.getDefaultModule(portal_type=parent_type)
+    self.login(original_owner_id)
+    document = module.newContent(portal_type=parent_type)
+    self.stepTic()
+    self.login(cloning_owner_id)
+    cloned_document = document.Base_createCloneDocument(batch_mode=1)
+    self.stepTic()
+    self.login()
+    # real assertions
+    # roles on original document
+    self.assertEqual(
+        document.get_local_roles(),
+        (((original_owner_id), ('Owner',)),)
+    )
+
+    # roles on cloned document
+    self.assertEqual(
+        cloned_document.get_local_roles(),
+        (((cloning_owner_id), ('Owner',)),)
+    )
+
+  def test_owner_local_role_on_clone_with_subobjects(self):
+    # check that tested stuff is ok
+    parent_type = 'Person'
     acquiring_type = 'Email'
     self.assertEquals(self.portal.portal_types[acquiring_type].acquire_local_roles, 1)
     self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0)
 
-    original_owner_id = 'original_user'
-    cloning_owner_id = 'cloning_user'
+    original_owner_id = 'original_user' + self.id()
+    cloning_owner_id = 'cloning_user' + self.id()
     self._createZodbUser(original_owner_id)
     self._createZodbUser(cloning_owner_id)
     transaction.commit()
@@ -700,7 +731,7 @@
     self.assertEqual(1, len(cloned_document.contentValues()))
     cloned_subdocument = cloned_document.contentValues()[0]
     # real assertions
-    # roles on original document
+    # roles on original documents
     self.assertEqual(
         document.get_local_roles(),
         (((original_owner_id), ('Owner',)),)
@@ -710,6 +741,7 @@
         (((original_owner_id), ('Owner',)),)
     )
 
+    # roles on cloned original documents
     self.assertEqual(
         cloned_document.get_local_roles(),
         (((cloning_owner_id), ('Owner',)),)




More information about the Erp5-report mailing list