def test_simulateItemRename(self): # an object is set in place, annotated and then renamed self._initPolicyAndUser() # allow copy/paste operations dummy = TheClass('dummy') site = self.root.site site._setObject('dummy', dummy) annotation = self.root.portal_uidannotation(dummy, UID_ATTRNAME) transaction.savepoint(optimistic=True) site.manage_renameObject(id='dummy', new_id='dummy2') new_annotation = getattr(site.dummy2, UID_ATTRNAME) self.assertEqual(annotation(), new_annotation())
def test_simulateItemCloneRemovingUid1(self): # an object is set in place, annotated and then copied self._initPolicyAndUser() # allow copy/paste operations dummy = TheClass('dummy') site = self.root.site site._setObject('dummy', dummy) annotation = self.root.portal_uidannotation(dummy, UID_ATTRNAME) self.root._setObject('folder1', SimpleFolder('folder1')) transaction.savepoint(optimistic=True) cookie = site.manage_copyObjects(ids=['dummy']) self.root.folder1.manage_pasteObjects( cookie ) self.assertRaises(AttributeError, getattr, self.root.folder1.dummy, UID_ATTRNAME)
def test_simulateItemCloneAssignsNewUid(self): # an object is set in place, annotated, and then copied self._initPolicyAndUser() # allow copy/paste operations dummy = TheClass('dummy') site = self.root.site site._setObject('dummy', dummy) annotation = self.root.portal_uidannotation(dummy, UID_ATTRNAME) self.root.portal_uidannotation.assign_on_clone = True self.root._setObject('folder1', SimpleFolder('folder1')) transaction.savepoint(optimistic=True) cookie = site.manage_copyObjects(ids=['dummy']) self.root.folder1.manage_pasteObjects( cookie ) new_annotation = getattr(self.root.folder1.dummy, UID_ATTRNAME) self.failIf( annotation() == new_annotation() )