Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def addUser2ToGroup
def testListAllowedRolesAndUsers
def testSearchReturnsDocument
def testSearchDoesNotReturnDocument
def testSearchReturnsDocumentUsing_DefaultAND
def testSearchReturnsDocumentUsing_AND
def testSearchReturnsDocumentUsing_OR
def testSearchReturnsDocumentWhenPermissionIsTroughLocalRole
def testSearchRespectsLocalRoleAcquisition
def testSearchRespectsLocalRoleAcquisitionDisabled
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 catalog
 workflow
 groups

Detailed Description

Definition at line 328 of file testCatalogTool.py.


Member Function Documentation

Definition at line 350 of file testCatalogTool.py.

00350 
00351     def addUser2ToGroup(self):
00352         self.groups.groupWorkspacesCreationFlag = 0
00353         self.groups.addGroup(group2, None, [], [])
00354         group = self.groups.getGroupById(group2)
00355         self.loginAsPortalOwner() # GRUF 3.52
00356         group.addMember(user2)
00357         self.login(default_user) # Back to normal
00358         return group2

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 330 of file testCatalogTool.py.

00330 
00331     def afterSetUp(self):
00332         self.catalog = self.portal.portal_catalog
00333         self.workflow = self.portal.portal_workflow
00334         self.groups = self.portal.portal_groups
00335 
00336         self.portal.acl_users._doAddUser(user2, 'secret', [], [])
00337 
00338         self.folder.invokeFactory('Document', id='doc', text='foo')
00339         self.folder.invokeFactory('Folder', id='folder2')
00340         self.folder.folder2.invokeFactory('Document', id='doc2', text='bar')
00341         self.workflow.doActionFor(self.folder.doc, 'hide', comment='')
00342         self.workflow.doActionFor(self.folder.folder2, 'hide', comment='')
00343         self.workflow.doActionFor(self.folder.folder2.doc2, 'hide', comment='')
00344 
00345         # Used for testing AND/OR search functionality below
00346         self.folder.invokeFactory('Document', id='aaa', text='aaa', title='ccc')
00347         self.folder.invokeFactory('Document', id='bbb', text='bbb')
00348 
00349         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 359 of file testCatalogTool.py.

00359 
00360     def testListAllowedRolesAndUsers(self):
00361         # Should include the group in list of allowed users
00362         groupname = self.addUser2ToGroup()
00363         uf = self.portal.acl_users
00364         self.failUnless(('user:%s' % groupname) in
00365                 self.catalog._listAllowedRolesAndUsers(uf.getUser(user2)))

Here is the call graph for this function:

Definition at line 370 of file testCatalogTool.py.

00370 
00371     def testSearchDoesNotReturnDocument(self):
00372         # Document should not be found when user2 does a search
00373         self.login(user2)
00374         self.assertEqual(len(self.catalog(SearchableText='foo')), 0)

Here is the call graph for this function:

Definition at line 400 of file testCatalogTool.py.

00400 
00401     def testSearchRespectsLocalRoleAcquisition(self):
00402         # After adding a group with access rights and containing user2,
00403         # a search must find the document in subfolders.
00404         groupname = self.addUser2ToGroup()
00405         self.setRequestMethod('POST')
00406         self.folder.folder_localrole_edit('add', [groupname], 'Owner')
00407         self.setRequestMethod('GET')
00408         self.login(user2)
00409         # Local Role works in subfolder
00410         self.assertEqual(self.catalog(SearchableText='bbb')[0].id, 'bbb')

Here is the call graph for this function:

Definition at line 411 of file testCatalogTool.py.

00411 
00412     def testSearchRespectsLocalRoleAcquisitionDisabled(self):
00413         # After adding a group with access rights and containing user2,
00414         # a search should not find documents in subfolders which have
00415         # disabled local role acquisition.
00416         groupname = self.addUser2ToGroup()
00417         self.setRequestMethod('POST')
00418         self.folder.folder_localrole_edit('add', [groupname], 'Owner')
00419         # Acquisition off for folder2
00420         self.folder.folder2.folder_localrole_set(use_acquisition=0)
00421         self.setRequestMethod('GET')
00422         # Everything in subfolder should be invisible
00423         self.login(user2)
00424         self.failIf(self.catalog(SearchableText='bar'))
00425 

Here is the call graph for this function:

Definition at line 366 of file testCatalogTool.py.

00366 
00367     def testSearchReturnsDocument(self):
00368         # Document should be found when owner does a search
00369         self.assertEqual(self.catalog(SearchableText='aaa')[0].id, 'aaa')

Definition at line 380 of file testCatalogTool.py.

00380 
00381     def testSearchReturnsDocumentUsing_AND(self):
00382         # Documents should not be found when owner does a search using AND
00383         self.assertEqual(len(self.catalog(SearchableText='aaa AND bbb')), 0)
00384         self.assertEqual(len(self.catalog(SearchableText='aaa AND ccc')), 1)

Definition at line 375 of file testCatalogTool.py.

00375 
00376     def testSearchReturnsDocumentUsing_DefaultAND(self):
00377         # Documents should not be found when searching 'aaa bbb' (which should default to AND)
00378         self.assertEqual(len(self.catalog(SearchableText='aaa bbb')), 0)
00379         self.assertEqual(len(self.catalog(SearchableText='aaa ccc')), 1)

Definition at line 385 of file testCatalogTool.py.

00385 
00386     def testSearchReturnsDocumentUsing_OR(self):
00387         # Two documents (aaa, bbb)  should be found when owner does a search using OR
00388         results = self.catalog(SearchableText='aaa OR bbb')
00389         self.assertEqual(len(results), 2)

Definition at line 390 of file testCatalogTool.py.

00390 
00391     def testSearchReturnsDocumentWhenPermissionIsTroughLocalRole(self):
00392         # After adding a group with access rights and containing user2,
00393         # a search must find the document.
00394         groupname = self.addUser2ToGroup()
00395         self.setRequestMethod('POST')
00396         self.folder.folder_localrole_edit('add', [groupname], 'Owner')
00397         self.setRequestMethod('GET')
00398         self.login(user2)
00399         self.assertEqual(self.catalog(SearchableText='aaa')[0].id, 'aaa')

Here is the call graph for this function:


Member Data Documentation

Definition at line 331 of file testCatalogTool.py.

Definition at line 333 of file testCatalogTool.py.

Definition at line 332 of file testCatalogTool.py.


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