Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFPlone.tests.testPloneFolder.TestFolderListing Class Reference
Inheritance diagram for CMFPlone.tests.testPloneFolder.TestFolderListing:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testPloneFolder.TestFolderListing:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testListFolderContentsOmitsPrivateObjects
def testListFolderContentsOmitsPrivateFolders
def testBugReport
def test_folder_contents
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 workflow

Private Member Functions

def _contentIds

Detailed Description

Definition at line 114 of file testPloneFolder.py.


Member Function Documentation

def CMFPlone.tests.testPloneFolder.TestFolderListing._contentIds (   self,
  folder 
) [private]

Definition at line 126 of file testPloneFolder.py.

00126 
00127     def _contentIds(self, folder):
00128         return [ob.getId() for ob in folder.listFolderContents()]

Here is the caller graph for this function:

Definition at line 117 of file testPloneFolder.py.

00117 
00118     def afterSetUp(self):
00119         self.workflow = self.portal.portal_workflow
00120         # Create some objects to list
00121         self.folder.invokeFactory('Folder', id='sub1')
00122         self.folder.invokeFactory('Folder', id='sub2')
00123         self.folder.invokeFactory('Document', id='doc1')
00124         self.folder.invokeFactory('Document', id='doc2')
00125         self.setupAuthenticator()

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 180 of file testPloneFolder.py.

00180 
00181     def test_folder_contents(self):
00182         self.folder.sub1.invokeFactory('Document', id='sub1doc1')
00183 
00184         contents = self.folder.sub1.getFolderContents()
00185         self.assertEqual(len(contents), 1)
00186         self.assertEqual(contents[0].getId, 'sub1doc1')
00187 
00188         self.failUnless(self.folder.sub1.old_folder_contents())
00189         view = self.folder.sub1.restrictedTraverse("folder_contents")
00190         self.failUnless(view())
00191 
00192         self.folder.sub1.manage_permission('List folder contents', ['Manager'], acquire=0)
00193 
00194         self.assertRaises(Unauthorized, self.folder.sub1.old_folder_contents)
00195         def func():
00196             return self.folder.sub1.restrictedTraverse("folder_contents")
00197         self.assertRaises(Unauthorized, func)
00198 

Definition at line 141 of file testPloneFolder.py.

00141 
00142     def testBugReport(self):
00143         # Perform the steps-to-reproduce in the collector issue:
00144 
00145         # 2)
00146         self.folder.invokeFactory('Folder', id='A')
00147         self.workflow.doActionFor(self.folder.A, 'publish')
00148 
00149         self.logout()
00150         self.assertEqual(self._contentIds(self.folder.A), [])
00151 
00152         # 3)
00153         self.login()
00154         self.folder.A.invokeFactory('Document', id='B')
00155         self.folder.A.B.manage_permission('View', ['Manager', 'Reviewer'], acquire=0)
00156 
00157         self.logout()
00158         self.assertEqual(self._contentIds(self.folder.A), [])
00159 
00160         # 4)
00161         self.login()
00162         self.folder.A.invokeFactory('Folder', id='C')
00163         self.folder.A.C.manage_permission('View', ['Manager', 'Reviewer'], acquire=0)
00164 
00165         # Here comes the reported bug:
00166         self.logout()
00167         self.assertEqual(self._contentIds(self.folder.A), ['C']) # <--
00168 
00169         # 4a)
00170         # BUT: removing 'View' is simply not enough!
00171         # When using the workflow all is fine:
00172         self.login()
00173         self.workflow.doActionFor(self.folder.A.C, 'hide')
00174 
00175         self.logout()
00176         self.assertEqual(self._contentIds(self.folder.A), [])
00177 
00178         # -> For folders you also have to remove 'Access contents information'
00179         # -> Never click around in the ZMI security screens, use the workflow!

Here is the call graph for this function:

Definition at line 135 of file testPloneFolder.py.

00135 
00136     def testListFolderContentsOmitsPrivateFolders(self):
00137         self.workflow.doActionFor(self.folder.sub1, 'hide')
00138         self.logout()
00139         self.assertEqual(self._contentIds(self.folder),
00140                          ['sub2', 'doc1', 'doc2'])

Here is the call graph for this function:

Definition at line 129 of file testPloneFolder.py.

00129 
00130     def testListFolderContentsOmitsPrivateObjects(self):
00131         self.workflow.doActionFor(self.folder.doc1, 'hide')
00132         self.logout()
00133         self.assertEqual(self._contentIds(self.folder),
00134                          ['sub1', 'sub2', 'doc2'])

Here is the call graph for this function:


Member Data Documentation

Definition at line 118 of file testPloneFolder.py.


The documentation for this class was generated from the following file: