This tests the behaviour when removing multiple referenced files (or actually images). The resulting confirmation pages should contain lists of all link integrity breaches that would result from removing the respective file. First we need to create the necessary links: >>> self.setRoles(('Manager',)) >>> p = self.portal >>> self.setText(p.doc1, p.image1.tag() + ', ' + p.image2.tag()) >>> self.setText(p.doc2, p.image1.tag() + ', ' + p.image3.tag()) Then we use a browser to try to delete the referenced images. 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 Image 1').selected = True >>> browser.getControl('Test Image 2').selected = True >>> browser.getControl('Test Image 3').selected = True >>> browser.getControl('Delete').click() >>> browser.contents '......href="http://nohost/plone/doc1"...Test Page 1...... ...
  • ...href="http://nohost/plone/doc2"...Test Page 2...
  • ... ...Would you like to delete it anyway?...' >>> browser.getControl(name='delete').click() Since separate events are fired for every item deleted by `manage_delObjects` there is no way to handle all potential integrity breaches in one single form, at least no general way. Therefore we are presented with several forms asking for confirmation in regard to breaches caused by deleting the individual items: >>> browser.contents '...
    ...href="http://nohost/plone/doc1"...Test Page 1...... ...Would you like to delete it anyway?...' >>> browser.getControl(name='delete').click() >>> browser.contents '......href="http://nohost/plone/doc2"...Test Page 2...... ...Would you like to delete it anyway?...' >>> browser.getControl(name='delete').click() After we acknowledge the breaches in link integrity the images should have been deleted: >>> portal.image1 Traceback (most recent call last): ... AttributeError: image1 >>> portal.image2 Traceback (most recent call last): ... AttributeError: image2 >>> portal.image3 Traceback (most recent call last): ... AttributeError: image3