Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.tests.testQueryCatalog.TestQueryCatalog Class Reference
Inheritance diagram for CMFPlone.tests.testQueryCatalog.TestQueryCatalog:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testQueryCatalog.TestQueryCatalog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def dummyCatalog
def stripStuff
def afterSetUp
def testEmptyRequest
def testNonexistantIndex
def testNonexistantIndex
def testRealIndex
def testTwoIndexes
def testRealIndexes
def testOnlySort
def testOnlyUsage
def testRealWithUsage
def testSortLimit
def testBlacklistedTypes
def testNavigationRoot
def testNavigationRootDoesNotOverrideExplicitPath
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Test queryCatalog script.

Test function of queryCatalog script, **not** the
functionality of the catalog itself. Therefore, we'll replace
the actual call to the catalog to a dummy routine that just
returns the catalog search dictionary so we can examine what
would be searched.

Definition at line 12 of file testQueryCatalog.py.


Member Function Documentation

Definition at line 35 of file testQueryCatalog.py.

00035 
00036     def afterSetUp(self):
00037         self.portal.portal_catalog.__call__ = self.dummyCatalog

Here is the call graph for this function:

def CMFPlone.tests.testQueryCatalog.TestQueryCatalog.dummyCatalog (   self,
  REQUEST = None,
  kw 
)

Definition at line 22 of file testQueryCatalog.py.

00022 
00023     def dummyCatalog(self,REQUEST=None,**kw):
00024         return kw

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:

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 25 of file testQueryCatalog.py.

00025 
00026     def stripStuff(self, query_dict):
00027         # strip portal_types and show_inactive parameter which is
00028         # auto-set with types blacklisting. Useful to simplify test
00029         # assertions when we don't care
00030         if type(query_dict) == types.DictType:
00031             for ignore in ['portal_type', 'show_inactive']:
00032                 if query_dict.has_key(ignore):
00033                     del query_dict[ignore]
00034         return query_dict

Here is the caller graph for this function:

Definition at line 90 of file testQueryCatalog.py.

00090 
00091     def testBlacklistedTypes(self):
00092         request = {'SearchableText':'a*'}
00093         siteProps = self.portal.portal_properties.site_properties
00094         siteProps.types_not_searched = ['Event', 'Unknown Type']
00095         qry = self.folder.queryCatalog(request,use_types_blacklist=True)
00096         self.failUnless('Document' in qry['portal_type'])
00097         self.failUnless('Event' not in qry['portal_type'])

Definition at line 38 of file testQueryCatalog.py.

00038 
00039     def testEmptyRequest(self):
00040         request = {}
00041         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])

Here is the call graph for this function:

Definition at line 98 of file testQueryCatalog.py.

00098 
00099     def testNavigationRoot(self):
00100         request = {'SearchableText':'a*'}
00101         ntp = self.portal.portal_properties.navtree_properties
00102         ntp.root = '/'
00103         qry = self.folder.queryCatalog(request, use_navigation_root=True)
00104         self.assertEquals('/'.join(self.portal.getPhysicalPath()), qry['path'])
00105         self.setRoles(('Manager',))
00106         self.portal.invokeFactory('Folder', 'foo')
00107         ntp.root = '/foo'
00108         qry = self.folder.queryCatalog(request, use_navigation_root=True)
00109         self.assertEquals('/'.join(self.portal.foo.getPhysicalPath()), qry['path'])
        

Here is the call graph for this function:

Definition at line 110 of file testQueryCatalog.py.

00110 
00111     def testNavigationRootDoesNotOverrideExplicitPath(self):
00112         request = {'SearchableText':'a*', 'path':'/yyy/zzz'}
00113         ntp = self.portal.portal_properties.navtree_properties
00114         self.setRoles(('Manager',))
00115         self.portal.invokeFactory('Folder', 'foo')
00116         ntp.root = '/foo'
00117         qry = self.folder.queryCatalog(request, use_navigation_root=True)
00118         self.assertEquals('/yyy/zzz', qry['path'])

Here is the call graph for this function:

Definition at line 42 of file testQueryCatalog.py.

00042 
00043     def testNonexistantIndex(self):
00044         request = {'foo':'bar'}
00045         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 46 of file testQueryCatalog.py.

00046 
00047     def testNonexistantIndex(self):
00048         request = {'foo':'bar'}
00049         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])

Here is the call graph for this function:

Definition at line 65 of file testQueryCatalog.py.

00065 
00066     def testOnlySort(self):
00067         # if we only sort, we shouldn't actually call the catalog
00068         request = {'sort_on':'foozle'}
00069         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])
00070         request = {'sort_order':'foozle','sort_on':'foozle'}
00071         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])
00072         request = {'sort_order':'foozle'}
00073         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])

Here is the call graph for this function:

Definition at line 74 of file testQueryCatalog.py.

00074 
00075     def testOnlyUsage(self):
00076         request = {'date_usage':'range:min'}
00077         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), [])

Here is the call graph for this function:

Definition at line 50 of file testQueryCatalog.py.

00050 
00051     def testRealIndex(self):
00052         request = {'SearchableText':'bar'}
00053         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), 
00054                             {'SearchableText':'bar'})

Here is the call graph for this function:

Definition at line 60 of file testQueryCatalog.py.

00060 
00061     def testRealIndexes(self):
00062         request = {'SearchableText':'bar','Subject':'bar'}
00063         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), 
00064                             request)

Here is the call graph for this function:

Definition at line 78 of file testQueryCatalog.py.

00078 
00079     def testRealWithUsage(self):
00080         request = {'modified':'2004-01-01','modified_usage':'range:min'}
00081         expected = {'modified': {'query': '2004-01-01', 'range': 'min'}}
00082         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), 
00083                             expected)

Here is the call graph for this function:

Definition at line 84 of file testQueryCatalog.py.

00084 
00085     def testSortLimit(self):
00086         # the script ignored 'sort_limit'; test to show it no longer does.
00087         request = {'SearchableText':'bar','sort_on':'foozle','sort_limit':50}
00088         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), 
00089                             request)

Here is the call graph for this function:

Definition at line 55 of file testQueryCatalog.py.

00055 
00056     def testTwoIndexes(self):
00057         request = {'SearchableText':'bar','foo':'bar'}
00058         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), 
00059                             {'SearchableText':'bar'})

Here is the call graph for this function:


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