This tests the behaviour when removing multiple referenced files. The single
resulting confirmation page should contain lists of all link integrity
breaches that would result from removing the referenced files. 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):
>>> self.setStatusCode('LinkIntegrityNotificationException', 200)
>>> 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......
......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()
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