This tests the behaviour when removing a referenced file. Especially,
this test may flush out a bug when using LinguaPlone. First we need
to create the necessary links:
>>> self.setRoles(('Manager',))
>>> p = self.portal
>>> self.setText(p.doc1, '%s' % (p.file1.absolute_url(),
... p.file1.title_or_id()))
The document should now have a reference to the file:
>>> p.doc1.getRefs()
[]
Then we use a browser to try to delete the referenced file. 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 File 1').selected = True
>>> browser.getControl('Delete').click()
>>> browser.contents
'......href="http://nohost/plone/doc1"...Test Page 1......
...Would you like to delete it anyway?...'
>>> browser.getControl(name='delete').click()
After we acknowledge the breaches in link integrity the file should have
been deleted::
>>> portal.file1
Traceback (most recent call last):
...
AttributeError: file1