Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def populateSite
def testCreateTopLevelTabs
def testTabsRespectFolderOrder
def testCustomQuery
def testStateFiltering
def testDisableFolderTabs
def testTabsExcludeItemsWithExcludeProperty
def testTabsRespectsTypesWithViewAction
def testTabsExcludeItemsInIdsNotToList
def testTabsExcludeNonFolderishItems
def testRootBelowPortalRoot
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 request

Static Public Attributes

 view_class = CatalogNavigationTabs

Detailed Description

Definition at line 662 of file testNavigationView.py.


Member Function Documentation

Definition at line 483 of file testNavigationView.py.

00483 
00484     def afterSetUp(self):
00485         self.request = self.app.REQUEST
00486         setDefaultSkin(self.request)
00487         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 488 of file testNavigationView.py.

00488 
00489     def populateSite(self):
00490         self.setRoles(['Manager'])
00491         self.portal.invokeFactory('Document', 'doc1')
00492         self.portal.invokeFactory('Document', 'doc2')
00493         self.portal.invokeFactory('Document', 'doc3')
00494         self.portal.invokeFactory('Folder', 'folder1')
00495         self.portal.invokeFactory('Folder', 'folder2')
00496         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 497 of file testNavigationView.py.

00497 
00498     def testCreateTopLevelTabs(self):
00499         # See if we can create one at all
00500         view = self.view_class(self.portal, self.request)
00501         
00502         #Everything shows up by default
00503         tabs = view.topLevelTabs()
00504         self.failUnless(tabs)
00505         self.assertEqual(len(tabs), 8)
00506         
00507         #Only the folders show up (Members, news, events, folder1, folder2)
00508         self.portal.portal_properties.site_properties.disable_nonfolderish_sections = True
00509         tabs = view.topLevelTabs()
00510         self.assertEqual(len(tabs), 5)

Here is the call graph for this function:

Definition at line 525 of file testNavigationView.py.

00525 
00526     def testCustomQuery(self):
00527         # Try a custom query script for the tabs that returns only published
00528         # objects
00529         self.portal._delObject('Members')
00530         self.portal._delObject('news')
00531         self.portal._delObject('events')
00532         workflow = self.portal.portal_workflow
00533         factory = self.portal.manage_addProduct['PythonScripts']
00534         factory.manage_addPythonScript('getCustomNavQuery')
00535         script = self.portal.getCustomNavQuery
00536         script.ZPythonScript_edit('', 'return {"review_state":"published"}')
00537         self.assertEqual(
00538             self.portal.getCustomNavQuery(), {"review_state":"published"})
00539         view = self.view_class(self.portal, self.request)
00540         tabs = view.topLevelTabs()
00541         #Should contain no folders
00542         self.assertEqual(len(tabs), 0)
00543         #change workflow for folder1
00544         workflow.doActionFor(self.portal.folder1, 'publish')
00545         self.portal.folder1.reindexObject()
00546         view = self.view_class(self.portal, self.request)
00547         tabs = view.topLevelTabs()
00548         #Should only contain the published folder
00549         self.assertEqual(len(tabs), 1)

Here is the call graph for this function:

Definition at line 571 of file testNavigationView.py.

00571 
00572     def testDisableFolderTabs(self):
00573         # Setting the site_property disable_folder_sections should remove
00574         # all folder based tabs
00575         props = self.portal.portal_properties.site_properties
00576         props.manage_changeProperties(disable_folder_sections=True)
00577         view = self.view_class(self.portal, self.request)
00578         tabs = view.topLevelTabs()
00579         self.assertEqual(tabs, [])

Here is the call graph for this function:

Definition at line 640 of file testNavigationView.py.

00640 
00641     def testRootBelowPortalRoot(self):
00642         
00643         self.setRoles(['Manager'])
00644         self.portal.folder1.invokeFactory('Document', 'doc1')
00645         self.portal.folder1.invokeFactory('Document', 'doc2')
00646         self.portal.folder1.invokeFactory('Document', 'doc3')
00647         self.portal.folder1.invokeFactory('Folder', 'folder1')
00648         self.portal.folder1.invokeFactory('Folder', 'folder2')
00649         self.setRoles(['Member'])
00650         
00651         rootPath = '/'.join(self.portal.getPhysicalPath()) + '/folder1'
00652         self.portal.portal_properties.navtree_properties.root = '/folder1'
00653         self.portal.portal_properties.site_properties.disable_nonfolderish_sections = True
00654         
00655         view = self.view_class(self.portal, self.request)
00656         tabs = view.topLevelTabs()
00657         self.failUnless(tabs)
00658         self.assertEqual(len(tabs), 2)
00659         self.assertEqual(tabs[0]['id'], 'folder1')
00660         self.assertEqual(tabs[1]['id'], 'folder2')
00661         

Here is the call graph for this function:

Definition at line 550 of file testNavigationView.py.

00550 
00551     def testStateFiltering(self):
00552         # Test tabs workflow state filtering
00553         self.portal._delObject('Members')
00554         self.portal._delObject('news')
00555         self.portal._delObject('events')
00556         workflow = self.portal.portal_workflow
00557         ntp=self.portal.portal_properties.navtree_properties
00558         ntp.manage_changeProperties(wf_states_to_show=['published'])
00559         ntp.manage_changeProperties(enable_wf_state_filtering=True)
00560         view = self.view_class(self.portal, self.request)
00561         tabs = view.topLevelTabs()
00562         #Should contain no folders
00563         self.assertEqual(len(tabs), 0)
00564         #change workflow for folder1
00565         workflow.doActionFor(self.portal.folder1, 'publish')
00566         self.portal.folder1.reindexObject()
00567         view = self.view_class(self.portal, self.request)
00568         tabs = view.topLevelTabs()
00569         #Should only contain the published folder
00570         self.assertEqual(len(tabs), 1)

Here is the call graph for this function:

Definition at line 612 of file testNavigationView.py.

00612 
00613     def testTabsExcludeItemsInIdsNotToList(self):
00614         # Make sure that items whose ids are in the idsNotToList navTree
00615         # property get purged
00616         view = self.view_class(self.portal, self.request)
00617         tabs = view.topLevelTabs()
00618         orig_len = len(tabs)
00619         ntp=self.portal.portal_properties.navtree_properties
00620         ntp.manage_changeProperties(idsNotToList=['folder2'])
00621         view = self.view_class(self.portal, self.request)
00622         tabs = view.topLevelTabs()
00623         self.failUnless(tabs)
00624         self.assertEqual(len(tabs), orig_len - 1)
00625         tab_names = [t['id'] for t in tabs]
00626         self.failIf('folder2' in tab_names)

Here is the call graph for this function:

Definition at line 580 of file testNavigationView.py.

00580 
00581     def testTabsExcludeItemsWithExcludeProperty(self):
00582         # Make sure that items witht he exclude_from_nav property are purged
00583         view = self.view_class(self.portal, self.request)
00584         tabs = view.topLevelTabs()
00585         orig_len = len(tabs)
00586         self.portal.folder2.setExcludeFromNav(True)
00587         self.portal.folder2.reindexObject()
00588         view = self.view_class(self.portal, self.request)
00589         tabs = view.topLevelTabs()
00590         self.failUnless(tabs)
00591         self.assertEqual(len(tabs), orig_len - 1)
00592         tab_names = [t['id'] for t in tabs]
00593         self.failIf('folder2' in tab_names)

Here is the call graph for this function:

Definition at line 627 of file testNavigationView.py.

00627 
00628     def testTabsExcludeNonFolderishItems(self):
00629         self.portal.portal_properties.site_properties.disable_nonfolderish_sections = True
00630         view = self.view_class(self.portal, self.request)
00631         tabs = view.topLevelTabs()
00632         orig_len = len(tabs)
00633         self.setRoles(['Manager','Member'])
00634         self.portal.invokeFactory('Document','foo')
00635         
00636         view = self.view_class(self.portal, self.request)
00637         tabs = view.topLevelTabs()
00638         self.failUnless(tabs)
00639         self.assertEqual(len(tabs),orig_len)

Here is the call graph for this function:

Definition at line 511 of file testNavigationView.py.

00511 
00512     def testTabsRespectFolderOrder(self):
00513         # See if reordering causes a change in the tab order
00514         view = self.view_class(self.portal, self.request)
00515         tabs1 = view.topLevelTabs()
00516         # Must be manager to change order on portal itself
00517         self.setRoles(['Manager','Member'])
00518         self.portal.folder_position('up', 'folder2')
00519         view = self.view_class(self.portal, self.request)
00520         tabs2 = view.topLevelTabs()
00521         #Same number of objects
00522         self.failUnlessEqual(len(tabs1), len(tabs2))
00523         #Different order
00524         self.failUnless(tabs1 != tabs2)

Here is the call graph for this function:

Definition at line 594 of file testNavigationView.py.

00594 
00595     def testTabsRespectsTypesWithViewAction(self):
00596         # With a type in typesUseViewActionInListings as current action it
00597         # should return a tab which has '/view' appended to the url
00598         view = self.view_class(self.portal, self.request)
00599         tabs = view.topLevelTabs()
00600         self.failUnless(tabs)
00601         # Fail if 'view' is used for folder
00602         self.failIf(tabs[-1]['url'][-5:]=='/view')
00603         # Add Folder to site_property
00604         props = self.portal.portal_properties.site_properties
00605         props.manage_changeProperties(
00606             typesUseViewActionInListings=['Image','File','Folder'])
00607         # Verify that we have '/view'
00608         view = self.view_class(self.portal, self.request)
00609         tabs = view.topLevelTabs()
00610         self.failUnless(tabs)
00611         self.assertEqual(tabs[-1]['url'][-5:],'/view')

Here is the call graph for this function:


Member Data Documentation

Definition at line 484 of file testNavigationView.py.

Reimplemented from CMFPlone.tests.testNavigationView.TestBasePortalTabs.

Definition at line 663 of file testNavigationView.py.


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