Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testSortTitleReturnsProperOrderForNumbers
def testSortTitleIgnoresCase
def testSortableTitleOutput
def testSortableNonASCIITitles
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 catalog

Detailed Description

Definition at line 426 of file testCatalogTool.py.


Member Function Documentation

Definition at line 428 of file testCatalogTool.py.

00428 
00429     def afterSetUp(self):
00430         self.catalog = self.portal.portal_catalog
00431 
00432         self.folder.invokeFactory('Document', id='doc', text='foo')
00433         self.folder.doc.setTitle('12 Document 25')
00434         self.folder.invokeFactory('Document', id='doc2', text='foo')
00435         self.folder.doc2.setTitle('3 Document 4')
00436         self.folder.invokeFactory('Document', id='doc3', text='foo')
00437         self.folder.doc3.setTitle('12 Document 4')
00438 
00439         self.folder.invokeFactory('Document', id='doc4', text='bar')
00440         self.folder.doc4.setTitle('document 12')
00441         self.folder.invokeFactory('Document', id='doc5', text='bar')
00442         self.folder.doc5.setTitle('Document 2')
00443         self.folder.invokeFactory('Document', id='doc6', text='bar')
00444         self.folder.doc6.setTitle('DOCUMENT 4')
00445         self.folder.doc.reindexObject()
00446         self.folder.doc2.reindexObject()
00447         self.folder.doc3.reindexObject()
00448         self.folder.doc4.reindexObject()
00449         self.folder.doc5.reindexObject()
00450         self.folder.doc6.reindexObject()

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

00472 
00473     def testSortableNonASCIITitles(self):
00474         #test a utf-8 encoded string gets properly unicode converted
00475         title = 'La Pe\xc3\xb1a'
00476         doc = self.folder.doc
00477         doc.setTitle(title)
00478         wrapped = ExtensibleIndexableObjectWrapper(doc, self.portal)
00479         wrapped.update(vars={})
00480         self.assertEqual(wrapped.sortable_title, u'la pe\xf1a'.encode('utf-8'))
00481 

Here is the call graph for this function:

Definition at line 465 of file testCatalogTool.py.

00465 
00466     def testSortableTitleOutput(self):
00467         doc = self.folder.doc
00468         wrapped = ExtensibleIndexableObjectWrapper(doc, self.portal)
00469         wrapped.update(vars={})
00470 
00471         self.assertEqual(wrapped.sortable_title, u'00000012 document 00000025')

Here is the call graph for this function:

Definition at line 458 of file testCatalogTool.py.

00458 
00459     def testSortTitleIgnoresCase(self):
00460         # Documents should be returned in case insensitive order
00461         results = self.catalog(SearchableText='bar', sort_on='sortable_title')
00462         self.assertEqual(results[0].getId, 'doc5')
00463         self.assertEqual(results[1].getId, 'doc6')
00464         self.assertEqual(results[2].getId, 'doc4')

Definition at line 451 of file testCatalogTool.py.

00451 
00452     def testSortTitleReturnsProperOrderForNumbers(self):
00453         # Documents should be returned in proper numeric order
00454         results = self.catalog(SearchableText='foo', sort_on='sortable_title')
00455         self.assertEqual(results[0].getId, 'doc2')
00456         self.assertEqual(results[1].getId, 'doc3')
00457         self.assertEqual(results[2].getId, 'doc')


Member Data Documentation

Definition at line 429 of file testCatalogTool.py.


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