Back to index

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

List of all members.

Public Member Functions

def dummyCatalog
def stripStuff
def afterSetUp
def testQuotingNone
def testQuotingNotNeeded
def testQuotingNotNeededWithNot
def testQuotingRequiredToEscape
def testQuotingRequiredToEscapeOptionOff
def testQuotingWithLeadingNot
def testEmptyItem
def testEmptyItemShowAll
def testBadCharsAreQuoted
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Test logic quoting features 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 119 of file testQueryCatalog.py.


Member Function Documentation

Definition at line 142 of file testQueryCatalog.py.

00142 
00143     def afterSetUp(self):
00144         self.portal.portal_catalog.__call__ = self.dummyCatalog

Here is the call graph for this function:

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

Definition at line 129 of file testQueryCatalog.py.

00129 
00130     def dummyCatalog(self, REQUEST=None, **kw):
00131         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 132 of file testQueryCatalog.py.

00132 
00133     def stripStuff(self, query_dict):
00134         # strip portal_types and show_inactive parameter which is
00135         # auto-set with types blacklisting. Useful to simplify test
00136         # assertions when we don't care
00137         if type(query_dict) == types.DictType:
00138             for ignore in ['portal_type', 'show_inactive']:
00139                 if query_dict.has_key(ignore):
00140                     del query_dict[ignore]
00141         return query_dict

Here is the caller graph for this function:

Definition at line 187 of file testQueryCatalog.py.

00187 
00188     def testBadCharsAreQuoted(self):
00189         request = {'SearchableText':'context(1)'}
00190         # Catalog gets ( or ) in search and quotes them to avoid parse error
00191         expected = {'SearchableText':'context"("1")"'}
00192         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), expected)
00193 

Here is the call graph for this function:

Definition at line 175 of file testQueryCatalog.py.

00175 
00176     def testEmptyItem(self):
00177         request = {'SearchableText':''}
00178         # queryCatalog will return empty result without calling the catalog tool
00179         expected = []
00180         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), expected)

Here is the call graph for this function:

Definition at line 181 of file testQueryCatalog.py.

00181 
00182     def testEmptyItemShowAll(self):
00183         request = {'SearchableText':''}
00184         # Catalog gets a blank search, and returns the empty dict
00185         expected = {}
00186         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request, show_all=1)), expected)

Here is the call graph for this function:

Definition at line 145 of file testQueryCatalog.py.

00145 
00146     def testQuotingNone(self):
00147         request = {'SearchableText':'Hello Joel'}
00148         expected = request
00149         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request, quote_logic=1)), expected)

Here is the call graph for this function:

Definition at line 150 of file testQueryCatalog.py.

00150 
00151     def testQuotingNotNeeded(self):
00152         request = {'SearchableText':'Hello or Joel'}
00153         expected = request
00154         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request, quote_logic=1)), expected)

Here is the call graph for this function:

Definition at line 155 of file testQueryCatalog.py.

00155 
00156     def testQuotingNotNeededWithNot(self):
00157         request = {'SearchableText':'Hello or not Joel'}
00158         expected = request
00159         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request, quote_logic=1)), expected)

Here is the call graph for this function:

Definition at line 160 of file testQueryCatalog.py.

00160 
00161     def testQuotingRequiredToEscape(self):
00162         request = {'SearchableText':'Hello Joel Or'}
00163         expected = {'SearchableText':'Hello Joel "Or"'}
00164         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request, quote_logic=1)), expected)

Here is the call graph for this function:

Definition at line 165 of file testQueryCatalog.py.

00165 
00166     def testQuotingRequiredToEscapeOptionOff(self):
00167         request = {'SearchableText':'Hello Joel Or'}
00168         expected = request
00169         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), expected)

Here is the call graph for this function:

Definition at line 170 of file testQueryCatalog.py.

00170 
00171     def testQuotingWithLeadingNot(self):
00172         request = {'SearchableText':'Not Hello Joel'}
00173         expected = request
00174         self.assertEqual(self.stripStuff(self.folder.queryCatalog(request)), expected)

Here is the call graph for this function:


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