Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def populateSite
def testCreateSitemap
def testComplexSitemap
def testSitemapWithTopLevel
def testSitemapWithBottomLevel
def testSitemapWithNavigationRoot
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 request

Static Public Attributes

 view_class = CatalogSiteMap

Detailed Description

Definition at line 472 of file testNavigationView.py.


Member Function Documentation

Definition at line 356 of file testNavigationView.py.

00356 
00357     def afterSetUp(self):
00358         self.request = self.app.REQUEST
00359         # Apply a default layer for view lookups to work in Zope 2.9+
00360         setDefaultSkin(self.request)
00361         self.populateSite()
        

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 362 of file testNavigationView.py.

00362 
00363     def populateSite(self):
00364         self.setRoles(['Manager'])
00365         self.portal.invokeFactory('Document', 'doc1')
00366         self.portal.invokeFactory('Document', 'doc2')
00367         self.portal.invokeFactory('Document', 'doc3')
00368         self.portal.invokeFactory('Folder', 'folder1')
00369         self.portal.invokeFactory('Link', 'link1')
00370         self.portal.link1.setRemoteUrl('http://plone.org')
00371         self.portal.link1.reindexObject()
00372         folder1 = getattr(self.portal, 'folder1')
00373         folder1.invokeFactory('Document', 'doc11')
00374         folder1.invokeFactory('Document', 'doc12')
00375         folder1.invokeFactory('Document', 'doc13')
00376         self.portal.invokeFactory('Folder', 'folder2')
00377         folder2 = getattr(self.portal, 'folder2')
00378         folder2.invokeFactory('Document', 'doc21')
00379         folder2.invokeFactory('Document', 'doc22')
00380         folder2.invokeFactory('Document', 'doc23')
00381         folder2.invokeFactory('File', 'file21')
00382         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 388 of file testNavigationView.py.

00388 
00389     def testComplexSitemap(self):
00390         # create and test a reasonabley complex sitemap
00391         path = lambda x: '/'.join(x.getPhysicalPath())
00392         # We do this in a strange order in order to maximally demonstrate the bug
00393         folder1 = self.portal.folder1
00394         folder1.invokeFactory('Folder','subfolder1')
00395         subfolder1 = folder1.subfolder1
00396         folder1.invokeFactory('Folder','subfolder2')
00397         subfolder2 = folder1.subfolder2
00398         subfolder1.invokeFactory('Folder','subfolder11')
00399         subfolder11 = subfolder1.subfolder11
00400         subfolder1.invokeFactory('Folder','subfolder12')
00401         subfolder12 = subfolder1.subfolder12
00402         subfolder2.invokeFactory('Folder','subfolder21')
00403         subfolder21 = subfolder2.subfolder21
00404         folder1.invokeFactory('Folder','subfolder3')
00405         subfolder3 = folder1.subfolder3
00406         subfolder2.invokeFactory('Folder','subfolder22')
00407         subfolder22 = subfolder2.subfolder22
00408         subfolder22.invokeFactory('Folder','subfolder221')
00409         subfolder221 = subfolder22.subfolder221
00410 
00411         # Increase depth
00412         ntp=self.portal.portal_properties.navtree_properties
00413         ntp.manage_changeProperties(sitemapDepth=5)
00414 
00415         view = self.view_class(self.portal, self.request)
00416         sitemap = view.siteMap()
00417 
00418         folder1map = sitemap['children'][6]
00419         self.assertEqual(len(folder1map['children']), 6)
00420         self.assertEqual(folder1map['item'].getPath(), path(folder1))
00421 
00422         subfolder1map = folder1map['children'][3]
00423         self.assertEqual(subfolder1map['item'].getPath(), path(subfolder1))
00424         self.assertEqual(len(subfolder1map['children']), 2)
00425 
00426         subfolder2map = folder1map['children'][4]
00427         self.assertEqual(subfolder2map['item'].getPath(), path(subfolder2))
00428         self.assertEqual(len(subfolder2map['children']), 2)
00429 
00430         subfolder3map = folder1map['children'][5]
00431         self.assertEqual(subfolder3map['item'].getPath(), path(subfolder3))
00432         self.assertEqual(len(subfolder3map['children']), 0)
00433 
00434         subfolder11map = subfolder1map['children'][0]
00435         self.assertEqual(subfolder11map['item'].getPath(), path(subfolder11))
00436         self.assertEqual(len(subfolder11map['children']), 0)
00437 
00438         subfolder21map = subfolder2map['children'][0]
00439         self.assertEqual(subfolder21map['item'].getPath(), path(subfolder21))
00440         self.assertEqual(len(subfolder21map['children']), 0)
00441 
00442         subfolder22map = subfolder2map['children'][1]
00443         self.assertEqual(subfolder22map['item'].getPath(), path(subfolder22))
00444         self.assertEqual(len(subfolder22map['children']), 1)
00445 
00446         # Why isn't this showing up in the sitemap
00447         subfolder221map = subfolder22map['children'][0]
00448         self.assertEqual(subfolder221map['item'].getPath(), path(subfolder221))
00449         self.assertEqual(len(subfolder221map['children']), 0)

Here is the call graph for this function:

Definition at line 383 of file testNavigationView.py.

00383 
00384     def testCreateSitemap(self):
00385         view = self.view_class(self.portal, self.request)
00386         tree = view.siteMap()
00387         self.failUnless(tree)

Here is the call graph for this function:

Definition at line 457 of file testNavigationView.py.

00457 
00458     def testSitemapWithBottomLevel(self):
00459         ntp = self.portal.portal_properties.navtree_properties
00460         ntp.manage_changeProperties(bottomLevel=1)
00461         view = self.view_class(self.portal, self.request)
00462         sitemap = view.siteMap()
00463         self.assertEqual(sitemap['children'][-1]['item'].getPath(), '/plone/folder2')
00464         self.failUnless(len(sitemap['children'][-1]['children']) > 0)
        

Here is the call graph for this function:

Definition at line 465 of file testNavigationView.py.

00465 
00466     def testSitemapWithNavigationRoot(self):
00467         ntp = self.portal.portal_properties.navtree_properties
00468         ntp.manage_changeProperties(root = '/folder2')
00469         view = self.view_class(self.portal, self.request)
00470         sitemap = view.siteMap()
00471         self.assertEqual(sitemap['children'][-1]['item'].getPath(), '/plone/folder2/file21')

Here is the call graph for this function:

Definition at line 450 of file testNavigationView.py.

00450 
00451     def testSitemapWithTopLevel(self):
00452         ntp = self.portal.portal_properties.navtree_properties
00453         ntp.manage_changeProperties(topLevel=1)
00454         view = self.view_class(self.portal, self.request)
00455         sitemap = view.siteMap()
00456         self.assertEqual(sitemap['children'][-1]['item'].getPath(), '/plone/folder2')
        

Here is the call graph for this function:


Member Data Documentation

Definition at line 357 of file testNavigationView.py.

Reimplemented from CMFPlone.tests.testNavigationView.TestBaseSiteMap.

Definition at line 473 of file testNavigationView.py.


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