This tests the behaviour when removing three objects referencing each other in a circle. This situation cannot be resolved completely, since the removal events are fired separately. However, the circle gets "broken up" when confirming the removal of the first object, and no further confirmation form are necessary: >>> self.setRoles(('Manager',)) >>> p = self.portal >>> self.setText(p.doc1, 'documents...') >>> self.setText(p.doc2, 'linking...') >>> self.setText(p.folder1.doc3, 'in circles.') >>> p.doc1.getReferences() [] >>> p.doc2.getReferences() [] >>> p.folder1.doc3.getReferences() [] We use a browser to try to delete all three documents. Before we can do this we need to prevent the test framework from choking on the exception we intentionally throw (see docs/testRemovalTriggersConfirmation.txt for more info). Also, we disable the event count helper (as set in folder_contents), so that all tests written so far won't need modification: >>> self.setStatusCode('LinkIntegrityNotificationException', 200) >>> self.disableEventCountHelper() >>> browser = self.getBrowser(loggedIn=True) >>> browser.open('http://nohost/plone/folder_contents') >>> browser.getControl('Test Page 1').selected = True >>> browser.getControl('Test Page 2').selected = True >>> browser.getControl('Test Folder 1').selected = True >>> browser.getControl('Delete').click() >>> browser.contents '......href="http://nohost/plone/folder1/doc3"...Test Page 3...... ...Would you like to delete it anyway?...' Before we continue with the removal of the item, we test for the presence of 'Test Page 2' in the list of referenced items. This should not appear as it links to an object contained in also to be deleted `folder1/`, and this breach can be filtered out even without the helper: >>> '
Test Page 2
' in browser.contents False Now we can continue, i.e. confirm the breaches: >>> browser.getControl(name='delete').click() At this point the remaining integrity breaches can be resolved automatically, since their target objects are known to be removed as well. Hence there are no further confirmation forms: >>> browser.url 'http://nohost/plone/...folder_contents' >>> browser.contents '...