Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.contentmenu.tests.TestDisplayMenu Class Reference

List of all members.

Public Member Functions

def afterSetUp
def testActionsMenuImplementsIBrowserMenu
def testActionsMenuImplementsIActionsMenu
def testTemplatesIncluded
def testSingleTemplateIncluded
def testNonBrowserDefaultReturnsNothing
def testDefaultPageIncludesParentOnlyWhenItemHasSingleView
def testDefaultPageIncludesParentAndItemViewsWhenItemHasMultipleViews
def testCurrentTemplateSelected
def testFolderCanSetDefaultPage
def testWithCanSetDefaultPageFalse
def testSelectItemNotIncludedInNonStructuralFolder
def testDefaultPageSelectedAndOverridesLayout
def testDefaultPageCanBeChangedInContext
def testDefaultPageCanBeChangedInFolder
def testSeparatorsIncludedWhenViewingDefaultPageWithViews
def testSeparatorsNotIncludedWhenViewingDefaultPageWithoutViews
def testSeparatorsNotDisplayedWhenViewingFolder
def testDefaultPageTemplateTitle

Public Attributes

 menu
 request

Detailed Description

Definition at line 46 of file tests.py.


Member Function Documentation

Definition at line 48 of file tests.py.

00048 
00049     def afterSetUp(self):
00050         self.menu = getUtility(IBrowserMenu, name='plone_contentmenu_display', context=self.folder)
00051         self.request = self.app.REQUEST

Definition at line 55 of file tests.py.

00055 
00056     def testActionsMenuImplementsIActionsMenu(self):
00057         self.failUnless(IDisplayMenu.providedBy(self.menu))

Definition at line 52 of file tests.py.

00052 
00053     def testActionsMenuImplementsIBrowserMenu(self):
00054         self.failUnless(IBrowserMenu.providedBy(self.menu))

Definition at line 95 of file tests.py.

00095 
00096     def testCurrentTemplateSelected(self):
00097         layout = self.folder.getLayout()
00098         actions = self.menu.getMenuItems(self.folder, self.request)
00099         selected = [a['extra']['id'] for a in actions if a['selected']]
00100         self.assertEqual(selected, ['folder_listing'])

Here is the call graph for this function:

Definition at line 129 of file tests.py.

00129 
00130     def testDefaultPageCanBeChangedInContext(self):
00131         self.folder.invokeFactory('Document', 'doc1')
00132         self.folder.setDefaultPage('doc1')
00133         actions = self.menu.getMenuItems(self.folder, self.request)
00134         self.failUnless('contextChangeDefaultPage' in [a['extra']['id'] for a in actions])

Here is the call graph for this function:

Definition at line 135 of file tests.py.

00135 
00136     def testDefaultPageCanBeChangedInFolder(self):
00137         self.folder.invokeFactory('Document', 'doc1')
00138         self.folder.setDefaultPage('doc1')
00139         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00140         self.failUnless('folderChangeDefaultPage' in [a['extra']['id'] for a in actions])
00141         self.failIf('contextChangeDefaultPage' in [a['extra']['id'] for a in actions])

Definition at line 84 of file tests.py.

00084 
00085     def testDefaultPageIncludesParentAndItemViewsWhenItemHasMultipleViews(self):
00086         fti = self.portal.portal_types['Document']
00087         documentViews = fti.view_methods + ('base_view',)
00088         fti.manage_changeProperties(view_methods = documentViews)
00089         self.folder.invokeFactory('Document', 'doc1')
00090         self.folder.setDefaultPage('doc1')
00091         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00092         self.failUnless('folderDefaultPageDisplay' in [a['extra']['id'] for a in actions])
00093         self.failUnless('document_view' in [a['extra']['id'] for a in actions])
00094         self.failUnless('base_view' in [a['extra']['id'] for a in actions])

Definition at line 77 of file tests.py.

00077 
00078     def testDefaultPageIncludesParentOnlyWhenItemHasSingleView(self):
00079         self.folder.invokeFactory('Document', 'doc1')
00080         self.folder.setDefaultPage('doc1')
00081         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00082         self.failUnless('folderDefaultPageDisplay' in [a['extra']['id'] for a in actions])
00083         self.failIf('document_view' in [a['extra']['id'] for a in actions])

Definition at line 122 of file tests.py.

00122 
00123     def testDefaultPageSelectedAndOverridesLayout(self):
00124         self.folder.invokeFactory('Document', 'doc1')
00125         self.folder.setDefaultPage('doc1')
00126         actions = self.menu.getMenuItems(self.folder, self.request)
00127         selected = [a['extra']['id'] for a in actions if a['selected']]
00128         self.assertEqual(selected, ['contextDefaultPageDisplay'])

Here is the call graph for this function:

Definition at line 177 of file tests.py.

00177 
00178     def testDefaultPageTemplateTitle(self):
00179         self.folder.setDefaultPage('sitemap') # Use a template in portal_skins
00180         actions = self.menu.getMenuItems(self.folder, self.request)
00181         changeAction = [x for x in actions if x['extra']['id'] == 'contextDefaultPageDisplay'][0]
00182         changeAction['title'].default
00183         self.assertEquals(u"Sitemap", changeAction['title'].mapping['contentitem'])
00184 

Here is the call graph for this function:

Definition at line 103 of file tests.py.

00103 
00104     def testFolderCanSetDefaultPage(self):
00105         self.folder.invokeFactory('Folder', 'f1')
00106         self.failUnless(self.folder.f1.canSetDefaultPage())
00107         actions = self.menu.getMenuItems(self.folder.f1, self.request)
00108         self.failUnless('contextSetDefaultPage' in [a['extra']['id'] for a in actions])

Definition at line 71 of file tests.py.

00071 
00072     def testNonBrowserDefaultReturnsNothing(self):
00073         f = dummy.Folder()
00074         self.folder._setObject('f1', f)
00075         actions = self.menu.getMenuItems(self.folder.f1, self.request)
00076         self.assertEqual(len(actions), 0)

Definition at line 116 of file tests.py.

00116 
00117     def testSelectItemNotIncludedInNonStructuralFolder(self):
00118         self.folder.invokeFactory('Folder', 'f1')
00119         directlyProvides(self.folder.f1, INonStructuralFolder)
00120         actions = self.menu.getMenuItems(self.folder.f1, self.request)
00121         self.failIf('contextSetDefaultPage' in [a['extra']['id'] for a in actions])

Here is the call graph for this function:

Definition at line 144 of file tests.py.

00144 
00145     def testSeparatorsIncludedWhenViewingDefaultPageWithViews(self):
00146         fti = self.portal.portal_types['Document']
00147         documentViews = fti.view_methods + ('base_view',)
00148         fti.manage_changeProperties(view_methods = documentViews)
00149         self.folder.invokeFactory('Document', 'doc1')
00150         self.folder.setDefaultPage('doc1')
00151         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00152         ids = [a['extra']['id'] for a in actions]
00153         self.failUnless('folderHeader' in ids)
00154         self.failUnless('contextHeader' in ids)

Definition at line 164 of file tests.py.

00164 
00165     def testSeparatorsNotDisplayedWhenViewingFolder(self):
00166         fti = self.portal.portal_types['Document']
00167         documentViews = fti.view_methods + ('base_view',)
00168         fti.manage_changeProperties(view_methods = documentViews)
00169         self.folder.invokeFactory('Document', 'doc1')
00170         self.folder.setDefaultPage('doc1')
00171         actions = self.menu.getMenuItems(self.folder, self.request)
00172         ids = [a['extra']['id'] for a in actions]
00173         self.failIf('folderHeader' in ids)
00174         self.failIf('contextHeader' in ids)

Here is the call graph for this function:

Definition at line 155 of file tests.py.

00155 
00156     def testSeparatorsNotIncludedWhenViewingDefaultPageWithoutViews(self):
00157         self.folder.invokeFactory('Document', 'doc1')
00158         self.folder.setDefaultPage('doc1')
00159         self.assertEqual(len(self.folder.doc1.getAvailableLayouts()), 1)
00160         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00161         ids = [a['extra']['id'] for a in actions]
00162         self.failIf('folderHeader' in ids)
00163         self.failIf('contextHeader' in ids)

Definition at line 65 of file tests.py.

00065 
00066     def testSingleTemplateIncluded(self):
00067         self.folder.invokeFactory('Document', 'doc1')
00068         actions = self.menu.getMenuItems(self.folder.doc1, self.request)
00069         self.assertEqual(len(actions), 1)
00070         self.assertEqual(actions[0]['extra']['id'], 'document_view')

Definition at line 60 of file tests.py.

00060 
00061     def testTemplatesIncluded(self):
00062         actions = self.menu.getMenuItems(self.folder, self.request)
00063         templates = [a['extra']['id'] for a in actions]
00064         self.failUnless('folder_listing' in templates)

Here is the call graph for this function:

Definition at line 109 of file tests.py.

00109 
00110     def testWithCanSetDefaultPageFalse(self):
00111         self.folder.invokeFactory('Folder', 'f1')
00112         self.folder.f1.manage_permission('Modify view template', ('Manager',))
00113         self.failIf(self.folder.f1.canSetDefaultPage())
00114         actions = self.menu.getMenuItems(self.folder.f1, self.request)
00115         self.failIf('contextSetDefaultPage' in [a['extra']['id'] for a in actions])


Member Data Documentation

Definition at line 49 of file tests.py.

Definition at line 50 of file tests.py.


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