Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFCore.tests.test_ActionInformation.ActionInfoSecurityTests Class Reference
Inheritance diagram for CMFCore.tests.test_ActionInformation.ActionInfoSecurityTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_ActionInformation.ActionInfoSecurityTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_create_from_dict
def test_category_object
def test_category_folder
def test_category_workflow
def test_category_document
def test_copy

Public Attributes

 site
 object
 folder

Private Member Functions

def _makeOne

Detailed Description

Definition at line 214 of file test_ActionInformation.py.


Member Function Documentation

def CMFCore.tests.test_ActionInformation.ActionInfoSecurityTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 221 of file test_ActionInformation.py.

00221 
00222     def _makeOne(self, *args, **kw):
00223         from Products.CMFCore.ActionInformation import ActionInfo
00224 
00225         return ActionInfo(*args, **kw)

Definition at line 216 of file test_ActionInformation.py.

00216 
00217     def setUp(self):
00218         SecurityTest.setUp(self)
00219         self.site = DummySite('site').__of__(self.root)
00220         self.site._setObject( 'portal_membership', DummyMembershipTool() )

Definition at line 293 of file test_ActionInformation.py.

00293 
00294     def test_category_document(self):
00295         # Permissions for action category 'document*' should be
00296         # evaluated in object context (not in portal context).
00297         manage_addFolder(self.site, 'actions_dummy')
00298         self.object = self.site.actions_dummy
00299         self.object.manage_permission('View', [], acquire=0)
00300 
00301         WANTED = {'allowed': False, 'category': 'document'}
00302 
00303         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00304         ec = createExprContext(self.site, self.site, self.object)
00305         ai = self._makeOne(action, ec)
00306         ai['category'] = 'document' # pfff
00307 
00308         self.assertEqual( ai['category'], WANTED['category'] )
00309         self.assertEqual( ai['allowed'], WANTED['allowed'] )

Here is the call graph for this function:

Definition at line 259 of file test_ActionInformation.py.

00259 
00260     def test_category_folder(self):
00261         # Permissions for action category 'folder*' should be
00262         # evaluated in folder context.
00263         manage_addFolder(self.site, 'actions_dummy')
00264         self.folder = self.site.actions_dummy
00265         self.folder.manage_permission('View', [], acquire=0)
00266 
00267         WANTED = {'allowed': False, 'category': 'folder'}
00268 
00269         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00270         ec = createExprContext(self.folder, self.site, None)
00271         ai = self._makeOne(action, ec)
00272         ai['category'] = 'folder' # pfff
00273 
00274         self.assertEqual( ai['category'], WANTED['category'] )
00275         self.assertEqual( ai['allowed'], WANTED['allowed'] )

Definition at line 243 of file test_ActionInformation.py.

00243 
00244     def test_category_object(self):
00245         # Permissions for action category 'object*' should be
00246         # evaluated in object context.
00247         manage_addFolder(self.site, 'actions_dummy')
00248         self.object = self.site.actions_dummy
00249         self.object.manage_permission('View', [], acquire=0)
00250 
00251         WANTED = {'allowed': False, 'category': 'object'}
00252 
00253         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00254         ec = createExprContext(self.site, self.site, self.object)
00255         ai = self._makeOne(action, ec)
00256 
00257         self.assertEqual( ai['category'], WANTED['category'] )
00258         self.assertEqual( ai['allowed'], WANTED['allowed'] )

Definition at line 276 of file test_ActionInformation.py.

00276 
00277     def test_category_workflow(self):
00278         # Permissions for action category 'workflow*' should be
00279         # evaluated in object context.
00280         manage_addFolder(self.site, 'actions_dummy')
00281         self.object = self.site.actions_dummy
00282         self.object.manage_permission('View', [], acquire=0)
00283 
00284         WANTED = {'allowed': False, 'category': 'workflow'}
00285 
00286         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00287         ec = createExprContext(self.site, self.site, self.object)
00288         ai = self._makeOne(action, ec)
00289         ai['category'] = 'workflow' # pfff
00290 
00291         self.assertEqual( ai['category'], WANTED['category'] )
00292         self.assertEqual( ai['allowed'], WANTED['allowed'] )

Here is the call graph for this function:

Definition at line 310 of file test_ActionInformation.py.

00310 
00311     def test_copy(self):
00312         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00313         ec = createExprContext(self.site, self.site, None)
00314         ai = self._makeOne(action, ec)
00315         ai2 = ai.copy()
00316 
00317         self.assertEqual( ai._lazy_keys, ['allowed'] )
00318         self.assertEqual( ai2._lazy_keys, ['allowed'] )
00319         self.failIf( ai2._lazy_keys is ai._lazy_keys )
00320         self.assertEqual( ai['allowed'], True )
00321         self.assertEqual( ai2['allowed'], True )
00322 

Here is the call graph for this function:

Definition at line 226 of file test_ActionInformation.py.

00226 
00227     def test_create_from_dict(self):
00228         WANTED = {'allowed': True, 'available': True, 'category': 'object',
00229                   'id': 'foo', 'title': 'foo', 'url': '', 'visible': True}
00230 
00231         action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
00232         ec = createExprContext(self.site, self.site, None)
00233         ai = self._makeOne(action, ec)
00234 
00235         self.assertEqual( ai['id'], WANTED['id'] )
00236         self.assertEqual( ai['title'], WANTED['title'] )
00237         self.assertEqual( ai['url'], WANTED['url'] )
00238         self.assertEqual( ai['category'], WANTED['category'] )
00239         self.assertEqual( ai['visible'], WANTED['visible'] )
00240         self.assertEqual( ai['available'], WANTED['available'] )
00241         self.assertEqual( ai['allowed'], WANTED['allowed'] )
00242         self.assertEqual( ai, WANTED )

Here is the call graph for this function:


Member Data Documentation

Definition at line 263 of file test_ActionInformation.py.

Definition at line 247 of file test_ActionInformation.py.

Definition at line 218 of file test_ActionInformation.py.


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