Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def nofx
def assertResults
def testCeilingPatch
def testSearchResults
def testCall
def testSearchResultsExpired
def testCallExpired
def testSearchResultsExpiredWithExpiredDisabled
def testCallExpiredWithExpiredDisabled
def testSearchResultsExpiredWithPermission
def testCallExpiredWithPermission
def testSearchResultsWithAdditionalExpiryFilter
def testSearchResultsExpiredWithAdditionalExpiryFilter
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 catalog

Detailed Description

Definition at line 793 of file testCatalogTool.py.


Member Function Documentation

Definition at line 795 of file testCatalogTool.py.

00795 
00796     def afterSetUp(self):
00797         self.catalog = self.portal.portal_catalog
00798         self.folder.invokeFactory('Document', id='doc')

Definition at line 805 of file testCatalogTool.py.

00805 
00806     def assertResults(self, result, expect):
00807         # Verifies ids of catalog results against expected ids
00808         lhs = [r.getId for r in result]
00809         lhs.sort()
00810         rhs = list(expect)
00811         rhs.sort()
00812         self.assertEqual(lhs, rhs)

Here is the caller graph for this function:

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:

Definition at line 799 of file testCatalogTool.py.

00799 
00800     def nofx(self):
00801         # Removes effective and expires to make sure we only test
00802         # the DateRangeIndex.
00803         self.catalog.delIndex('effective')
00804         self.catalog.delIndex('expires')

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 820 of file testCatalogTool.py.

00820 
00821     def testCall(self):
00822         res = self.catalog()
00823         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 831 of file testCatalogTool.py.

00831 
00832     def testCallExpired(self):
00833         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00834         self.folder.doc.reindexObject()
00835         self.nofx()
00836         res = self.catalog()
00837         self.assertResults(res, base_content[:-1])

Here is the call graph for this function:

Definition at line 845 of file testCatalogTool.py.

00845 
00846     def testCallExpiredWithExpiredDisabled(self):
00847         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00848         self.folder.doc.reindexObject()
00849         self.nofx()
00850         res = self.catalog(show_inactive=True)
00851         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 860 of file testCatalogTool.py.

00860 
00861     def testCallExpiredWithPermission(self):
00862         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00863         self.folder.doc.reindexObject()
00864         self.nofx()
00865         self.setPermissions([AccessInactivePortalContent])
00866         res = self.catalog()
00867         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 813 of file testCatalogTool.py.

00813 
00814     def testCeilingPatch(self):
00815         self.assertEqual(self.folder.doc.expires(), DateTime(2500, 0))

Definition at line 816 of file testCatalogTool.py.

00816 
00817     def testSearchResults(self):
00818         res = self.catalog.searchResults()
00819         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 824 of file testCatalogTool.py.

00824 
00825     def testSearchResultsExpired(self):
00826         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00827         self.folder.doc.reindexObject()
00828         self.nofx()
00829         res = self.catalog.searchResults()
00830         self.assertResults(res, base_content[:-1])

Here is the call graph for this function:

Definition at line 886 of file testCatalogTool.py.

00886 
00887     def testSearchResultsExpiredWithAdditionalExpiryFilter(self):
00888         # Now make the object expire at some date in the recent past
00889         self.folder.doc.setExpirationDate(DateTime()-2)
00890         self.folder.doc.reindexObject()
00891         res = self.catalog.searchResults()
00892         self.assertResults(res, base_content[:-1])
00893         # Even if we explicitly ask for it, we shouldn't get expired content
00894         res = self.catalog.searchResults(expires={'query':DateTime()-3,
00895                                                   'range':'min'})
00896         self.assertResults(res, base_content[:-1])
00897 

Here is the call graph for this function:

Definition at line 838 of file testCatalogTool.py.

00838 
00839     def testSearchResultsExpiredWithExpiredDisabled(self):
00840         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00841         self.folder.doc.reindexObject()
00842         self.nofx()
00843         res = self.catalog.searchResults(show_inactive=True)
00844         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 852 of file testCatalogTool.py.

00852 
00853     def testSearchResultsExpiredWithPermission(self):
00854         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00855         self.folder.doc.reindexObject()
00856         self.nofx()
00857         self.setPermissions([AccessInactivePortalContent])
00858         res = self.catalog.searchResults()
00859         self.assertResults(res, base_content)

Here is the call graph for this function:

Definition at line 868 of file testCatalogTool.py.

00868 
00869     def testSearchResultsWithAdditionalExpiryFilter(self):
00870         # For this test we want the expires and effective indices in place,
00871         # let's make sure everything still works
00872         self.folder.doc.setExpirationDate(DateTime(2000, 12, 31))
00873         self.folder.doc.reindexObject()
00874         res = self.catalog.searchResults()
00875         self.assertResults(res, base_content[:-1])
00876         # Now make the object expire at some fixed date in the future
00877         self.folder.doc.setExpirationDate(DateTime()+2)
00878         self.folder.doc.reindexObject()
00879         res = self.catalog.searchResults()
00880         self.assertResults(res, base_content)
00881         # We should be able to further limit the search using the exipres
00882         # and efective indices.
00883         res = self.catalog.searchResults(expires={'query':DateTime()+3,
00884                                                   'range':'min'})
00885         self.assertResults(res, base_content[:-1])

Here is the call graph for this function:


Member Data Documentation

Definition at line 796 of file testCatalogTool.py.


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