def test_file_download_no_notification_when_system(self): _original_security = AccessControl.getSecurityManager() _system_user = AccessControl.SecurityManagement.SpecialUsers.system AccessControl.SecurityManagement.newSecurityManager(None, _system_user) self.index_html() events = [e for e in eventtesting.getEvents() if IFileDownloadedEvent.providedBy(e)] self.assertEqual(0, len(events)) AccessControl.SecurityManagement.setSecurityManager( _original_security) _original_security = None
def test_file_download_notification(self): self.index_html() events = [e for e in eventtesting.getEvents() if IFileDownloadedEvent.providedBy(e)] self.assertEqual(1, len(events))