Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def getModificationPermissions
def removePermissionsFromObject
def testDisplayContentsTab
def testAnonymous
def testNoListPermission
def testNoModificationPermissions
def testOnlyModifyPermission
def testOnlyCopyPermission
def testOnlyDeletePermission
def testOnlyAddPermission
def testNonFolderishObjectDoesNotShowTab
def testFolderishDefaultPageUsesParentPermissions
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 parent

Detailed Description

For the contents tab to display a user must have the ListFolderContents,
   and one of the (Modify portal contents, Copy or move, Add portal contents,
   Delete objects) permissions either on the object itself, or on the
   parent object if the object is not folderish or is the default page for
   its parent.

Definition at line 20 of file testDisplayContentsTab.py.


Member Function Documentation

Definition at line 28 of file testDisplayContentsTab.py.

00028 
00029     def afterSetUp(self):
00030         self.parent = self.folder.aq_parent
00031         self.folder.invokeFactory('Folder', id='foo')
00032         self.folder.foo.invokeFactory('Document', id='doc1')
00033         self.folder.foo.invokeFactory('Folder', id='folder1')
00034         folder_path = '/'.join(self.folder.foo.folder1.getPhysicalPath())
00035         transaction.savepoint(optimistic=True) # make rename work
00036         # Make the folder the default page
00037         self.setupAuthenticator()
00038         self.setRequestMethod('POST')
00039         self.folder.folder_rename(paths=[folder_path], new_ids=['index_html'], new_titles=['Default Folderish Document'])
00040         self.setRequestMethod('GET')

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 41 of file testDisplayContentsTab.py.

00041 
00042     def getModificationPermissions(self):
00043         return [ModifyPortalContent,
00044                 AddPortalContent,
00045                 copy_or_move,
00046                 delete_objects,
00047                 ReviewPortalContent]

Here is the caller graph for this function:

Definition at line 48 of file testDisplayContentsTab.py.

00048 
00049     def removePermissionsFromObject(self, permissions, object):
00050         for permission in permissions:
00051             object.manage_permission(permission, ['Manager'], acquire=0)

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 56 of file testDisplayContentsTab.py.

00056 
00057     def testAnonymous(self):
00058         # Anonymous should not see the tab
00059         self.logout()
00060         self.failIf(self.folder.displayContentsTab())

Here is the call graph for this function:

Definition at line 52 of file testDisplayContentsTab.py.

00052 
00053     def testDisplayContentsTab(self):
00054         # We should see the tab
00055         self.failUnless(self.folder.displayContentsTab())

Definition at line 107 of file testDisplayContentsTab.py.

00107 
00108     def testFolderishDefaultPageUsesParentPermissions(self):
00109         # The availability of the contents tab on a default page should be
00110         # based on the parents permissions, whether the default page is
00111         # folderish or not.
00112         def_page = self.folder.foo.index_html
00113         self.failUnless(def_page.displayContentsTab())
00114         self.folder.foo.manage_permission(ListFolderContents, ['Manager'], acquire=0)
00115         # Clear the memoized results, as it would happen for a new request
00116         del self.app.REQUEST.__annotations__
00117         self.failIf(def_page.displayContentsTab())
00118 

Definition at line 61 of file testDisplayContentsTab.py.

00061 
00062     def testNoListPermission(self):
00063         # We should not see the tab without ListFolderContents
00064         self.folder.manage_permission(ListFolderContents, ['Manager'], acquire=0)
00065         self.failIf(self.folder.displayContentsTab())

Definition at line 66 of file testDisplayContentsTab.py.

00066 
00067     def testNoModificationPermissions(self):
00068         # We should see the tab with only copy_or_move
00069         perms = self.getModificationPermissions()
00070         self.removePermissionsFromObject(perms, self.folder)
00071         self.failIf(self.folder.displayContentsTab())

Here is the call graph for this function:

Definition at line 101 of file testDisplayContentsTab.py.

00101 
00102     def testNonFolderishObjectDoesNotShowTab(self):
00103         # The availability of the contents tab on a non-folderish object should be
00104         # based on the parents permissions.
00105         doc = self.folder.foo.doc1
00106         self.failIf(doc.displayContentsTab())

Definition at line 94 of file testDisplayContentsTab.py.

00094 
00095     def testOnlyAddPermission(self):
00096         # We should see the tab with only copy_or_move
00097         perms = self.getModificationPermissions()
00098         perms.remove(AddPortalContent)
00099         self.removePermissionsFromObject(perms, self.folder)
00100         self.failUnless(self.folder.displayContentsTab())

Here is the call graph for this function:

Definition at line 79 of file testDisplayContentsTab.py.

00079 
00080     def testOnlyCopyPermission(self):
00081         # We should NOT see the tab with only copy_or_move (r8620)
00082         # Otherwise Members always get the green border.
00083         perms = self.getModificationPermissions()
00084         perms.remove(copy_or_move)
00085         self.removePermissionsFromObject(perms, self.folder)
00086         self.failIf(self.folder.displayContentsTab())

Here is the call graph for this function:

Definition at line 87 of file testDisplayContentsTab.py.

00087 
00088     def testOnlyDeletePermission(self):
00089         # We should see the tab with only copy_or_move
00090         perms = self.getModificationPermissions()
00091         perms.remove(delete_objects)
00092         self.removePermissionsFromObject(perms, self.folder)
00093         self.failUnless(self.folder.displayContentsTab())

Here is the call graph for this function:

Definition at line 72 of file testDisplayContentsTab.py.

00072 
00073     def testOnlyModifyPermission(self):
00074         # We should see the tab with only ModifyPortalContent
00075         perms = self.getModificationPermissions()
00076         perms.remove(ModifyPortalContent)
00077         self.removePermissionsFromObject(perms, self.folder)
00078         self.failUnless(self.folder.displayContentsTab())

Here is the call graph for this function:


Member Data Documentation

Definition at line 29 of file testDisplayContentsTab.py.


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