Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def populateSite
def testGetFromRoot
def testGetFromRootWithSpecifiedRoot
def testGetFromRootWithNodeFilter
def testGetFromRootWithNodeFilterOnFolder
def testGetFromRootWithSubtreeFilter
def testNonFolderishObjectNotExpanded
def testShowAllParentsOverridesNonFolderishObjectNotExpanded
def testGetWithRootContext
def testGetFromFixed
def testGetFromFixedAndDepth
def testGetFromRootWithCurrent
def testGetFromRootIgnoresDefaultPages
def testGetFromRootWithCurrentIsDefaultPage
def testGetFromRootWithCustomQuery
def testGetFromRootWithDecoratorFactory
def testShowAllParents
def testShowAllParentsWithRestrictedParent
def testShowAllParentsWithParentNotInCatalog
def testDontShowAllParents
def testGetFromRootWithCurrentNavtree
def testGetFromRootWithCurrentNavtreeAndStartLevel
def testGetFromRootWithCurrentNavtreePruned
def testGetFromRootWithCurrentFolderishNavtreePruned
def testCurrentParent
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Test the basic buildFolderTree method

Definition at line 32 of file testNavTree.py.


Member Function Documentation

Definition at line 35 of file testNavTree.py.

00035 
00036     def afterSetUp(self):
00037         self.populateSite()
00038         self.setupAuthenticator()

Here is the call 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:

    Portal
    +-doc1
    +-doc2
    +-doc3
    +-folder1
      +-doc11
      +-doc12
      +-doc13
    +-link1
    +-folder2
      +-doc21
      +-doc22
      +-doc23
      +-file21
      +-folder21
+-doc211
+-doc212

Definition at line 39 of file testNavTree.py.

00039 
00040     def populateSite(self):
00041         """
00042             Portal
00043             +-doc1
00044             +-doc2
00045             +-doc3
00046             +-folder1
00047               +-doc11
00048               +-doc12
00049               +-doc13
00050             +-link1
00051             +-folder2
00052               +-doc21
00053               +-doc22
00054               +-doc23
00055               +-file21
00056               +-folder21
00057                 +-doc211
00058                 +-doc212
00059         """
00060         self.setRoles(['Manager'])
00061 
00062         for item in self.portal.getFolderContents():
00063             self.portal._delObject(item.getId)
00064 
00065         self.portal.invokeFactory('Document', 'doc1')
00066         self.portal.invokeFactory('Document', 'doc2')
00067         self.portal.invokeFactory('Document', 'doc3')
00068         self.portal.invokeFactory('Folder', 'folder1')
00069         self.portal.invokeFactory('Link', 'link1')
00070         self.portal.link1.setRemoteUrl('http://plone.org')
00071         self.portal.link1.reindexObject()
00072         folder1 = getattr(self.portal, 'folder1')
00073         folder1.invokeFactory('Document', 'doc11')
00074         folder1.invokeFactory('Document', 'doc12')
00075         folder1.invokeFactory('Document', 'doc13')
00076         self.portal.invokeFactory('Folder', 'folder2')
00077         folder2 = getattr(self.portal, 'folder2')
00078         folder2.invokeFactory('Document', 'doc21')
00079         folder2.invokeFactory('Document', 'doc22')
00080         folder2.invokeFactory('Document', 'doc23')
00081         folder2.invokeFactory('File', 'file21')
00082         folder2.invokeFactory('Folder', 'folder21')
00083         folder21 = getattr(folder2, 'folder21')
00084         folder21.invokeFactory('Document', 'doc211')
00085         folder21.invokeFactory('Document', 'doc212')
00086         self.setRoles(['Member'])

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 457 of file testNavTree.py.

00457 
00458     def testCurrentParent(self):
00459         self.loginAsPortalOwner()
00460         self.portal.invokeFactory('Document', 'doc')
00461         context = self.portal.doc1
00462         tree = buildFolderTree(self.portal, obj=context)['children']
00463         for t in tree:
00464             if t['item'].getId == 'doc':
00465                 self.assertEqual(t['currentParent'], False)

Here is the call graph for this function:

Definition at line 365 of file testNavTree.py.

00365 
00366     def testDontShowAllParents(self):
00367         strategy = NavtreeStrategyBase()
00368         strategy.showAllParents = False
00369         query = {'portal_type' : 'Folder'}
00370         context = self.portal.folder1.doc11
00371         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=strategy)['children']
00372         rootPath = '/'.join(self.portal.getPhysicalPath())
00373         self.assertEqual(len(tree), 2)
00374         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1')
00375         self.assertEqual(len(tree[0]['children']), 0)
00376         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder2')
00377         self.assertEqual(len(tree[1]['children']), 1)
00378         self.assertEqual(tree[1]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21')

Here is the call graph for this function:

Definition at line 223 of file testNavTree.py.

00223 
00224     def testGetFromFixed(self):
00225         rootPath = '/'.join(self.portal.getPhysicalPath())
00226         query = {'path' : rootPath + '/folder1'}
00227         tree = buildFolderTree(self.portal, query=query)['children']
00228         self.assertEqual(len(tree), 3)
00229         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1/doc11')
00230         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder1/doc12')
00231         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/folder1/doc13')

Here is the call graph for this function:

Definition at line 232 of file testNavTree.py.

00232 
00233     def testGetFromFixedAndDepth(self):
00234         rootPath = '/'.join(self.portal.getPhysicalPath())
00235         query = {'path' : rootPath + '/folder2', 'depth' : 1}
00236         tree = buildFolderTree(self.portal, query=query)['children']
00237         self.assertEqual(len(tree), 5)
00238         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder2/doc21')
00239         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder2/doc22')
00240         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/folder2/doc23')
00241         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder2/file21')
00242         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/folder2/folder21')

Here is the call graph for this function:

Definition at line 89 of file testNavTree.py.

00089 
00090     def testGetFromRoot(self):
00091         tree = buildFolderTree(self.portal)['children']
00092         rootPath = '/'.join(self.portal.getPhysicalPath())
00093         self.assertEqual(len(tree), 6)
00094         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00095         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00096         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00097         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00098         self.assertEqual(len(tree[3]['children']), 3)
00099         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00100         self.assertEqual(tree[3]['children'][1]['item'].getPath(), rootPath + '/folder1/doc12')
00101         self.assertEqual(tree[3]['children'][2]['item'].getPath(), rootPath + '/folder1/doc13')
00102         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00103         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00104         self.assertEqual(len(tree[5]['children']), 5)
00105         self.assertEqual(tree[5]['children'][0]['item'].getPath(), rootPath + '/folder2/doc21')
00106         self.assertEqual(tree[5]['children'][1]['item'].getPath(), rootPath + '/folder2/doc22')
00107         self.assertEqual(tree[5]['children'][2]['item'].getPath(), rootPath + '/folder2/doc23')
00108         self.assertEqual(tree[5]['children'][3]['item'].getPath(), rootPath + '/folder2/file21')
00109         self.assertEqual(tree[5]['children'][4]['item'].getPath(), rootPath + '/folder2/folder21')
00110         self.assertEqual(len(tree[5]['children'][4]['children']), 2)
00111         self.assertEqual(tree[5]['children'][4]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21/doc211')
00112         self.assertEqual(tree[5]['children'][4]['children'][1]['item'].getPath(), rootPath + '/folder2/folder21/doc212')

Here is the call graph for this function:

Definition at line 262 of file testNavTree.py.

00262 
00263     def testGetFromRootIgnoresDefaultPages(self):
00264         self.portal.folder1.setDefaultPage('doc12')
00265         self.portal.folder2.setDefaultPage('doc21')
00266         tree = buildFolderTree(self.portal)['children']
00267         rootPath = '/'.join(self.portal.getPhysicalPath())
00268         self.assertEqual(len(tree), 6)
00269         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00270         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00271         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00272         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00273         self.assertEqual(len(tree[3]['children']), 2)
00274         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00275         self.assertEqual(tree[3]['children'][1]['item'].getPath(), rootPath + '/folder1/doc13')
00276         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00277         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00278         self.assertEqual(len(tree[5]['children']), 4)
00279         self.assertEqual(tree[5]['children'][0]['item'].getPath(), rootPath + '/folder2/doc22')
00280         self.assertEqual(tree[5]['children'][1]['item'].getPath(), rootPath + '/folder2/doc23')
00281         self.assertEqual(tree[5]['children'][2]['item'].getPath(), rootPath + '/folder2/file21')
00282         self.assertEqual(tree[5]['children'][3]['item'].getPath(), rootPath + '/folder2/folder21')
00283         self.assertEqual(len(tree[5]['children'][3]['children']), 2)
00284         self.assertEqual(tree[5]['children'][3]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21/doc211')
00285         self.assertEqual(tree[5]['children'][3]['children'][1]['item'].getPath(), rootPath + '/folder2/folder21/doc212')

Here is the call graph for this function:

Definition at line 243 of file testNavTree.py.

00243 
00244     def testGetFromRootWithCurrent(self):
00245         context = self.portal.folder2.doc21
00246         tree = buildFolderTree(self.portal, obj=context)['children']
00247         self.assertEqual(len(tree), 6)
00248         for t in tree:
00249             if t['item'].getId == 'folder2':
00250                 self.assertEqual(t['currentItem'], False)
00251                 self.assertEqual(t['currentParent'], True)
00252                 for c in t['children']:
00253                     if c['item'].getId == 'doc21':
00254                         self.assertEqual(c['currentItem'], True)
00255                         self.assertEqual(c['currentParent'], False)
00256                     else:
00257                         self.assertEqual(c['currentItem'], False)
00258                         self.assertEqual(c['currentParent'], False)
00259             else:
00260                 self.assertEqual(t['currentItem'], False)
00261                 self.assertEqual(t['currentParent'], False)

Here is the call graph for this function:

Definition at line 432 of file testNavTree.py.

00432 
00433     def testGetFromRootWithCurrentFolderishNavtreePruned(self):
00434         context = self.portal.folder2.folder21
00435         class Strategy(NavtreeStrategyBase):
00436             def subtreeFilter(self, node):
00437                 return (node['item'].getId != 'folder2')
00438             showAllParents=True
00439 
00440         query = {'path' : {'query' : '/'.join(context.getPhysicalPath()),
00441                            'navtree' : 1}}
00442         rootPath = '/'.join(self.portal.getPhysicalPath())
00443         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=Strategy())['children']
00444         self.assertEqual(len(tree), 6)
00445         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00446         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00447         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00448         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00449         self.assertEqual(len(tree[3]['children']), 0)
00450         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00451         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00452         self.assertEqual(len(tree[5]['children']), 1)
00453         self.assertEqual(tree[5]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21')
00454         self.assertEqual(len(tree[5]['children'][0]['children']), 2)
00455         self.assertEqual(tree[5]['children'][0]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21/doc211')
00456         self.assertEqual(tree[5]['children'][0]['children'][1]['item'].getPath(), rootPath + '/folder2/folder21/doc212')

Here is the call graph for this function:

Definition at line 286 of file testNavTree.py.

00286 
00287     def testGetFromRootWithCurrentIsDefaultPage(self):
00288         self.portal.folder2.setDefaultPage('doc21')
00289         context = self.portal.folder2.doc21
00290         tree = buildFolderTree(self.portal, obj=context)['children']
00291         for t in tree:
00292             if t['item'].getId == 'folder2':
00293                 self.assertEqual(t['currentItem'], True)
00294                 self.assertEqual(t['currentParent'], False)
00295                 for c in t['children']:
00296                     self.assertEqual(c['currentItem'], False)
00297                     self.assertEqual(c['currentParent'], False)
00298             else:
00299                 self.assertEqual(t['currentItem'], False)
00300                 self.assertEqual(t['currentParent'], False)

Here is the call graph for this function:

Definition at line 379 of file testNavTree.py.

00379 
00380     def testGetFromRootWithCurrentNavtree(self):
00381         context = self.portal.folder1.doc11
00382         query = {'path' : {'query' : '/'.join(context.getPhysicalPath()),
00383                            'navtree' : 1}}
00384         tree = buildFolderTree(self.portal, query=query)['children']
00385         rootPath = '/'.join(self.portal.getPhysicalPath())
00386         self.assertEqual(len(tree), 6)
00387         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00388         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00389         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00390         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00391         self.assertEqual(len(tree[3]['children']), 3)
00392         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00393         self.assertEqual(tree[3]['children'][1]['item'].getPath(), rootPath + '/folder1/doc12')
00394         self.assertEqual(tree[3]['children'][2]['item'].getPath(), rootPath + '/folder1/doc13')
00395         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00396         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00397         self.assertEqual(len(tree[5]['children']), 0)

Here is the call graph for this function:

Definition at line 398 of file testNavTree.py.

00398 
00399     def testGetFromRootWithCurrentNavtreeAndStartLevel(self):
00400         context = self.portal.folder1.doc11
00401         query = {'path' : {'query' : '/'.join(context.getPhysicalPath()),
00402                            'navtree' : 1,
00403                            'navtree_start' : 2}}
00404         rootPath = '/'.join(self.portal.getPhysicalPath())
00405         tree = buildFolderTree(self.portal, query=query)['children']
00406         self.assertEqual(len(tree), 3)
00407         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1/doc11')
00408         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder1/doc12')
00409         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/folder1/doc13')

Here is the call graph for this function:

Definition at line 410 of file testNavTree.py.

00410 
00411     def testGetFromRootWithCurrentNavtreePruned(self):
00412         context = self.portal.folder1.doc11
00413         class Strategy(NavtreeStrategyBase):
00414             def subtreeFilter(self, node):
00415                 return (node['item'].getId != 'folder1')
00416             showAllParents = True
00417 
00418         query = {'path' : {'query' : '/'.join(context.getPhysicalPath()),
00419                            'navtree' : 1}}
00420         rootPath = '/'.join(self.portal.getPhysicalPath())
00421         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=Strategy())['children']
00422         self.assertEqual(len(tree), 6)
00423         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00424         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00425         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00426         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00427         self.assertEqual(len(tree[3]['children']), 1)
00428         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00429         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00430         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00431         self.assertEqual(len(tree[5]['children']), 0)

Here is the call graph for this function:

Definition at line 301 of file testNavTree.py.

00301 
00302     def testGetFromRootWithCustomQuery(self):
00303         query = {'portal_type' : 'Document'}
00304         tree = buildFolderTree(self.portal, query=query)['children']
00305         rootPath = '/'.join(self.portal.getPhysicalPath())
00306         self.assertEqual(len(tree), 3)
00307         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00308         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00309         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')

Here is the call graph for this function:

Definition at line 310 of file testNavTree.py.

00310 
00311     def testGetFromRootWithDecoratorFactory(self):
00312         class Strategy(NavtreeStrategyBase):
00313             def decoratorFactory(self, node):
00314                 node['foo'] = True
00315                 return node
00316         tree = buildFolderTree(self.portal, strategy=Strategy())['children']
00317         self.assertEqual(tree[0]['foo'], True)

Here is the call graph for this function:

Definition at line 123 of file testNavTree.py.

00123 
00124     def testGetFromRootWithNodeFilter(self):
00125         class Strategy(NavtreeStrategyBase):
00126             def nodeFilter(self, node):
00127                 return ('doc' not in node['item'].getId)
00128         tree = buildFolderTree(self.portal, strategy=Strategy())['children']
00129         rootPath = '/'.join(self.portal.getPhysicalPath())
00130         self.assertEqual(len(tree), 3)
00131         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1')
00132         self.assertEqual(len(tree[0]['children']), 0)
00133         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/link1')
00134         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/folder2')
00135         self.assertEqual(len(tree[2]['children']), 2)
00136         self.assertEqual(tree[2]['children'][0]['item'].getPath(), rootPath + '/folder2/file21')
00137         self.assertEqual(tree[2]['children'][1]['item'].getPath(), rootPath + '/folder2/folder21')
00138         self.assertEqual(len(tree[2]['children'][1]['children']), 0)

Here is the call graph for this function:

Definition at line 139 of file testNavTree.py.

00139 
00140     def testGetFromRootWithNodeFilterOnFolder(self):
00141         class Strategy(NavtreeStrategyBase):
00142             def nodeFilter(self, node):
00143                 return ('folder' not in node['item'].getId)
00144         tree = buildFolderTree(self.portal, strategy=Strategy())['children']
00145         rootPath = '/'.join(self.portal.getPhysicalPath())
00146         self.assertEqual(len(tree), 4)
00147         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00148         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00149         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00150         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/link1')

Here is the call graph for this function:

Definition at line 113 of file testNavTree.py.

00113 
00114     def testGetFromRootWithSpecifiedRoot(self):
00115         rootPath = '/'.join(self.portal.getPhysicalPath())
00116         strategy = NavtreeStrategyBase()
00117         strategy.rootPath = rootPath + '/folder1'
00118         tree = buildFolderTree(self.portal, strategy=strategy)['children']
00119         self.assertEqual(len(tree), 3)
00120         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1/doc11')
00121         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder1/doc12')
00122         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/folder1/doc13')

Here is the call graph for this function:

Definition at line 151 of file testNavTree.py.

00151 
00152     def testGetFromRootWithSubtreeFilter(self):
00153         class Strategy(NavtreeStrategyBase):
00154             def subtreeFilter(self, node):
00155                 return ('folder2' != node['item'].getId)
00156         tree = buildFolderTree(self.portal, strategy=Strategy())['children']
00157         rootPath = '/'.join(self.portal.getPhysicalPath())
00158         self.assertEqual(len(tree), 6)
00159         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00160         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00161         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00162         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00163         self.assertEqual(len(tree[3]['children']), 3)
00164         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00165         self.assertEqual(tree[3]['children'][1]['item'].getPath(), rootPath + '/folder1/doc12')
00166         self.assertEqual(tree[3]['children'][2]['item'].getPath(), rootPath + '/folder1/doc13')
00167         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00168         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00169         self.assertEqual(len(tree[5]['children']), 0)

Here is the call graph for this function:

Definition at line 199 of file testNavTree.py.

00199 
00200     def testGetWithRootContext(self):
00201         tree = buildFolderTree(self.portal, obj=self.portal)['children']
00202         rootPath = '/'.join(self.portal.getPhysicalPath())
00203         self.assertEqual(len(tree), 6)
00204         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/doc1')
00205         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/doc2')
00206         self.assertEqual(tree[2]['item'].getPath(), rootPath + '/doc3')
00207         self.assertEqual(tree[3]['item'].getPath(), rootPath + '/folder1')
00208         self.assertEqual(len(tree[3]['children']), 3)
00209         self.assertEqual(tree[3]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00210         self.assertEqual(tree[3]['children'][1]['item'].getPath(), rootPath + '/folder1/doc12')
00211         self.assertEqual(tree[3]['children'][2]['item'].getPath(), rootPath + '/folder1/doc13')
00212         self.assertEqual(tree[4]['item'].getPath(), rootPath + '/link1')
00213         self.assertEqual(tree[5]['item'].getPath(), rootPath + '/folder2')
00214         self.assertEqual(len(tree[5]['children']), 5)
00215         self.assertEqual(tree[5]['children'][0]['item'].getPath(), rootPath + '/folder2/doc21')
00216         self.assertEqual(tree[5]['children'][1]['item'].getPath(), rootPath + '/folder2/doc22')
00217         self.assertEqual(tree[5]['children'][2]['item'].getPath(), rootPath + '/folder2/doc23')
00218         self.assertEqual(tree[5]['children'][3]['item'].getPath(), rootPath + '/folder2/file21')
00219         self.assertEqual(tree[5]['children'][4]['item'].getPath(), rootPath + '/folder2/folder21')
00220         self.assertEqual(len(tree[5]['children'][4]['children']), 2)
00221         self.assertEqual(tree[5]['children'][4]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21/doc211')
00222         self.assertEqual(tree[5]['children'][4]['children'][1]['item'].getPath(), rootPath + '/folder2/folder21/doc212')

Here is the call graph for this function:

Definition at line 170 of file testNavTree.py.

00170 
00171     def testNonFolderishObjectNotExpanded(self):
00172         self.setRoles(['Manager'])
00173         f = DummyNonStructuralFolder('ns_folder')
00174         self.portal._setObject('ns_folder', f)
00175         ns_folder = self.portal.ns_folder
00176         self.portal.portal_catalog.indexObject(self.portal.ns_folder)
00177         ns_folder.invokeFactory('Document', 'doc')
00178         self.setRoles(['Member'])
00179         tree = buildFolderTree(self.portal, self.portal.ns_folder)['children']
00180         rootPath = '/'.join(self.portal.getPhysicalPath())
00181         self.assertEqual(tree[-1]['item'].getPath(), rootPath + '/ns_folder')
00182         self.assertEqual(len(tree[-1]['children']), 0)

Here is the call graph for this function:

Definition at line 318 of file testNavTree.py.

00318 
00319     def testShowAllParents(self):
00320         strategy = NavtreeStrategyBase()
00321         strategy.showAllParents = True
00322         query = {'portal_type' : 'Folder'}
00323         context = self.portal.folder1.doc11
00324         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=strategy)['children']
00325         rootPath = '/'.join(self.portal.getPhysicalPath())
00326         self.assertEqual(len(tree), 2)
00327         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1')
00328         self.assertEqual(len(tree[0]['children']), 1)
00329         self.assertEqual(tree[0]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00330         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder2')
00331         self.assertEqual(len(tree[1]['children']), 1)
00332         self.assertEqual(tree[1]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21')

Here is the call graph for this function:

Definition at line 183 of file testNavTree.py.

00183 
00184     def testShowAllParentsOverridesNonFolderishObjectNotExpanded(self):
00185         strategy = NavtreeStrategyBase()
00186         strategy.showAllParents = True
00187         self.setRoles(['Manager'])
00188         f = DummyNonStructuralFolder('ns_folder')
00189         self.portal._setObject('ns_folder', f)
00190         ns_folder = self.portal.ns_folder
00191         self.portal.portal_catalog.indexObject(self.portal.ns_folder)
00192         ns_folder.invokeFactory('Document', 'doc')
00193         self.setRoles(['Member'])
00194         tree = buildFolderTree(self.portal, self.portal.ns_folder.doc, strategy=strategy)['children']
00195         rootPath = '/'.join(self.portal.getPhysicalPath())
00196         self.assertEqual(tree[-1]['item'].getPath(), rootPath + '/ns_folder')
00197         self.assertEqual(len(tree[-1]['children']), 1)
00198         self.assertEqual(tree[-1]['children'][0]['item'].getPath(), rootPath + '/ns_folder/doc')

Here is the call graph for this function:

Definition at line 351 of file testNavTree.py.

00351 
00352     def testShowAllParentsWithParentNotInCatalog(self):
00353         strategy = NavtreeStrategyBase()
00354         strategy.showAllParents = True
00355         wftool = getToolByName(self.portal, 'portal_workflow')
00356         self.portal.folder1.unindexObject()
00357         query = {'portal_type' : 'Folder'}
00358         context = self.portal.folder1.doc11
00359         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=strategy)['children']
00360         rootPath = '/'.join(self.portal.getPhysicalPath())
00361         # XXX: Ideally, this shouldn't happen, we should get a dummy node, but
00362         # there's no way to do that with the catalog
00363         self.assertEqual(len(tree), 1)
00364         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder2')

Here is the call graph for this function:

Definition at line 333 of file testNavTree.py.

00333 
00334     def testShowAllParentsWithRestrictedParent(self):
00335         strategy = NavtreeStrategyBase()
00336         strategy.showAllParents = True
00337         wftool = getToolByName(self.portal, 'portal_workflow')
00338         wftool.doActionFor(self.portal.folder1, 'hide')
00339         self.portal.folder1.reindexObject()
00340         query = {'portal_type' : 'Folder'}
00341         context = self.portal.folder1.doc11
00342         tree = buildFolderTree(self.portal, query=query, obj=context, strategy=strategy)['children']
00343         rootPath = '/'.join(self.portal.getPhysicalPath())
00344         self.assertEqual(len(tree), 2)
00345         self.assertEqual(tree[0]['item'].getPath(), rootPath + '/folder1')
00346         self.assertEqual(len(tree[0]['children']), 1)
00347         self.assertEqual(tree[0]['children'][0]['item'].getPath(), rootPath + '/folder1/doc11')
00348         self.assertEqual(tree[1]['item'].getPath(), rootPath + '/folder2')
00349         self.assertEqual(len(tree[1]['children']), 1)
00350         self.assertEqual(tree[1]['children'][0]['item'].getPath(), rootPath + '/folder2/folder21')

Here is the call graph for this function:


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