Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.tests.testSecurityDeclarations.TestSecurityDeclarations Class Reference
Inheritance diagram for CMFPlone.tests.testSecurityDeclarations.TestSecurityDeclarations:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testSecurityDeclarations.TestSecurityDeclarations:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testImport_log
def testAccess_log
def testImport_log_deprecated
def testAccess_log_deprecated
def testImport_log_exc
def testAccess_log_exc
def testImport_getLogger
def testAccess_getLogger
def testImport_IndexIterator
def testAccess_IndexIterator
def testUse_IndexIterator
def testImport_ObjectMoved
def testAccess_ObjectMoved
def testUse_ObjectMoved
def testImport_ObjectDeleted
def testAccess_ObjectDeleted
def testUse_ObjectDeleted
def testImport_WorkflowException
def testAccess_WorkflowException
def testUse_WorkflowException
def testImport_Batch
def testAccess_Batch
def testUse_Batch
def testImport_transaction_note
def testAccess_transaction_note
def testImport_base_hasattr
def testAccess_base_hasattr
def testImport_safe_hasattr
def testAccess_safe_hasattr
def testImport_safe_callable
def testAccess_safe_callable
def testImport_Unauthorized
def testAccess_Unauthorized
def testImport_zExceptionsUnauthorized
def testImport_ConflictError
def testAccess_ConflictError
def testRaise_ConflictError
def testCatch_ConflictErrorRaisedByRestrictedCode
def testCatch_ConflictErrorRaisedByPythonModule
def testImport_ParseError
def testAccess_ParseError
def testCatch_ParseErrorRaisedByPythonModule
def testImport_DateTimeError
def testAccess_DateTimeError
def testCatch_DateTimeErrorRaisedByPythonModule
def testImport_SyntaxError
def testAccess_SyntaxError
def testCatch_SyntaxErrorRaisedByPythonModule
def testImport_CopyError
def testAccess_CopyError
def testCatch_CopyErrorRaisedByPythonModule
def testImport_DiscussionNotAllowed
def testAccess_DiscussionNotAllowed
def testCatch_DiscussionNotAllowedRaisedByPythonModule
def testImport_PTS
def testImport_isRTL
def testAccess_isRTL
def testImport_getToolByName
def testAccess_getToolByName
def testUse_getToolByName
def testImport_transaction
def testUse_transaction
def testImport_AllowSendto
def testAccess_AllowSendto
def testImport_mergeResults
def addPS
def check
def checkUnauthorized

Detailed Description

Definition at line 40 of file testSecurityDeclarations.py.


Member Function Documentation

def CMFPlone.tests.testSecurityDeclarations.RestrictedPythonTest.addPS (   self,
  id,
  params = '',
  body = '' 
) [inherited]

Definition at line 20 of file testSecurityDeclarations.py.

00020 
00021     def addPS(self, id, params='', body=''):
00022         factory = self.folder.manage_addProduct['PythonScripts']
00023         factory.manage_addPythonScript(id)
00024         self.folder[id].ZPythonScript_edit(params, body)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 25 of file testSecurityDeclarations.py.

00025 
00026     def check(self, psbody):
00027         self.addPS('ps', body=psbody)
00028         try:
00029             self.folder.ps()
00030         except (ImportError, Unauthorized), e:
00031             self.fail(e)

Here is the call graph for this function:

Definition at line 32 of file testSecurityDeclarations.py.

00032 
00033     def checkUnauthorized(self, psbody):
00034         self.addPS('ps', body=psbody)
00035         try:
00036             self.folder.ps()
00037         except (AttributeError, ImportError, Unauthorized):
00038             pass
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 356 of file testSecurityDeclarations.py.

00356 
00357     def testAccess_AllowSendto(self):
00358         # TODO: Note that this is NOT allowed!
00359         self.checkUnauthorized('from Products.CMFPlone import PloneTool;'
00360                                'print PloneTool.AllowSendto')

Here is the call graph for this function:

Definition at line 143 of file testSecurityDeclarations.py.

00143 
00144     def testAccess_base_hasattr(self):
00145         self.check('import Products.CMFPlone.utils;'
00146                    'print Products.CMFPlone.utils.base_hasattr')

Here is the call graph for this function:

Definition at line 123 of file testSecurityDeclarations.py.

00123 
00124     def testAccess_Batch(self):
00125         self.check('from Products import CMFPlone;'
00126                    'print CMFPlone.Batch')

Here is the call graph for this function:

Definition at line 177 of file testSecurityDeclarations.py.

00177 
00178     def testAccess_ConflictError(self):
00179         self.check('import ZODB.POSException;'
00180                    'print ZODB.POSException.ConflictError')

Here is the call graph for this function:

Definition at line 273 of file testSecurityDeclarations.py.

00273 
00274     def testAccess_CopyError(self):
00275         self.check('import OFS.CopySupport;'
00276                    'print OFS.CopySupport.CopyError')

Here is the call graph for this function:

Definition at line 233 of file testSecurityDeclarations.py.

00233 
00234     def testAccess_DateTimeError(self):
00235         self.check('import DateTime.DateTime;'
00236                    'print DateTime.DateTime.DateTimeError')

Here is the call graph for this function:

Definition at line 293 of file testSecurityDeclarations.py.

00293 
00294     def testAccess_DiscussionNotAllowed(self):
00295         self.check('import Products.CMFDefault.DiscussionTool;'
00296                    'print Products.CMFDefault.DiscussionTool.DiscussionNotAllowed')

Here is the call graph for this function:

Definition at line 71 of file testSecurityDeclarations.py.

00071 
00072     def testAccess_getLogger(self):
00073         self.check('from logging import getLogger;'
00074                    'log = getLogger("testlog");'
00075                    'log.debug("test")')

Here is the call graph for this function:

Definition at line 332 of file testSecurityDeclarations.py.

00332 
00333     def testAccess_getToolByName(self):
00334         # TODO: Note that this is NOT allowed!
00335         self.checkUnauthorized('from Products.CMFCore import utils;'
00336                                'print utils.getToolByName')

Here is the call graph for this function:

Definition at line 79 of file testSecurityDeclarations.py.

00079 
00080     def testAccess_IndexIterator(self):
00081         self.check('from Products import CMFPlone;'
00082                    'print CMFPlone.IndexIterator')

Here is the call graph for this function:

Definition at line 323 of file testSecurityDeclarations.py.

00323 
00324         def testAccess_isRTL(self):
00325             self.check('import Products.PlacelessTranslationService;'
00326                        'print Products.PlacelessTranslationService.isRTL')

Here is the call graph for this function:

Definition at line 50 of file testSecurityDeclarations.py.

00050 
00051     def testAccess_log(self):
00052         self.check('from Products.CMFPlone import utils;'
00053                    'print utils.log')

Here is the call graph for this function:

Definition at line 57 of file testSecurityDeclarations.py.

00057 
00058     def testAccess_log_deprecated(self):
00059         self.check('from Products.CMFPlone import utils;'
00060                    'print utils.log_deprecated')

Here is the call graph for this function:

Definition at line 64 of file testSecurityDeclarations.py.

00064 
00065     def testAccess_log_exc(self):
00066         self.check('from Products.CMFPlone import utils;'
00067                    'print utils.log_exc')

Here is the call graph for this function:

Definition at line 101 of file testSecurityDeclarations.py.

00101 
00102     def testAccess_ObjectDeleted(self):
00103         self.check('from Products.CMFCore import WorkflowCore;'
00104                    'print WorkflowCore.ObjectDeleted')

Here is the call graph for this function:

Definition at line 90 of file testSecurityDeclarations.py.

00090 
00091     def testAccess_ObjectMoved(self):
00092         self.check('from Products.CMFCore import WorkflowCore;'
00093                    'print WorkflowCore.ObjectMoved')

Here is the call graph for this function:

Definition at line 212 of file testSecurityDeclarations.py.

00212 
00213     def testAccess_ParseError(self):
00214         self.check('import Products.ZCTextIndex.ParseTree;'
00215                    'print Products.ZCTextIndex.ParseTree.ParseError')

Here is the call graph for this function:

Definition at line 157 of file testSecurityDeclarations.py.

00157 
00158     def testAccess_safe_callable(self):
00159         self.check('import Products.CMFPlone.utils;'
00160                    'print Products.CMFPlone.utils.safe_callable')

Here is the call graph for this function:

Definition at line 150 of file testSecurityDeclarations.py.

00150 
00151     def testAccess_safe_hasattr(self):
00152         self.check('import Products.CMFPlone.utils;'
00153                    'print Products.CMFPlone.utils.safe_hasattr')

Here is the call graph for this function:

Definition at line 254 of file testSecurityDeclarations.py.

00254 
00255     def testAccess_SyntaxError(self):
00256         self.check('import DateTime.DateTime;'
00257                    'print DateTime.DateTime.SyntaxError')

Here is the call graph for this function:

Definition at line 136 of file testSecurityDeclarations.py.

00136 
00137     def testAccess_transaction_note(self):
00138         self.check('import Products.CMFPlone.utils;'
00139                    'print Products.CMFPlone.utils.transaction_note')

Here is the call graph for this function:

Definition at line 166 of file testSecurityDeclarations.py.

00166 
00167     def testAccess_Unauthorized(self):
00168         self.check('import AccessControl;'
00169                    'print AccessControl.Unauthorized')

Here is the call graph for this function:

Definition at line 112 of file testSecurityDeclarations.py.

00112 
00113     def testAccess_WorkflowException(self):
00114         self.check('from Products.CMFCore import WorkflowCore;'
00115                    'print WorkflowCore.WorkflowException')

Here is the call graph for this function:

Definition at line 197 of file testSecurityDeclarations.py.

00197 
00198     def testCatch_ConflictErrorRaisedByPythonModule(self):
00199         self.folder._setObject('raiseConflictError', dummy.Raiser(ConflictError))
00200         try:
00201             self.check('''
00202 from ZODB.POSException import ConflictError
00203 try: context.raiseConflictError()
00204 except ConflictError: pass
00205 ''')
00206         except Exception, e:
00207             self.fail('Failed to catch: %s %s (module %s)' %
00208                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 186 of file testSecurityDeclarations.py.

00186 
00187     def testCatch_ConflictErrorRaisedByRestrictedCode(self):
00188         try:
00189             self.check('''
00190 from ZODB.POSException import ConflictError
00191 try: raise ConflictError
00192 except ConflictError: pass
00193 ''')
00194         except Exception, e:
00195             self.fail('Failed to catch: %s %s (module %s)' %
00196                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 277 of file testSecurityDeclarations.py.

00277 
00278     def testCatch_CopyErrorRaisedByPythonModule(self):
00279         self.folder._setObject('raiseCopyError', dummy.Raiser(CopyError))
00280         try:
00281             self.check('''
00282 from OFS.CopySupport import CopyError
00283 try: context.raiseCopyError()
00284 except CopyError: pass
00285 ''')
00286         except Exception, e:
00287             self.fail('Failed to catch: %s %s (module %s)' %
00288                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 237 of file testSecurityDeclarations.py.

00237 
00238     def testCatch_DateTimeErrorRaisedByPythonModule(self):
00239         self.folder._setObject('raiseDateTimeError', dummy.Raiser(self.DateTimeError))
00240         try:
00241             self.check('''
00242 from DateTime.DateTime import DateTimeError
00243 try: context.raiseDateTimeError()
00244 except DateTimeError: pass
00245 ''')
00246         except Exception, e:
00247             self.fail('Failed to catch: %s %s (module %s)' %
00248                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 297 of file testSecurityDeclarations.py.

00297 
00298     def testCatch_DiscussionNotAllowedRaisedByPythonModule(self):
00299         self.folder._setObject('raiseDiscussionNotAllowed',
00300                                dummy.Raiser(DiscussionNotAllowed))
00301         try:
00302             self.check('''
00303 from Products.CMFDefault.DiscussionTool import DiscussionNotAllowed
00304 try: context.raiseDiscussionNotAllowed()
00305 except DiscussionNotAllowed: pass
00306 ''')
00307         except Exception, e:
00308             self.fail('Failed to catch: %s %s (module %s)' %
00309                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 216 of file testSecurityDeclarations.py.

00216 
00217     def testCatch_ParseErrorRaisedByPythonModule(self):
00218         self.folder._setObject('raiseParseError', dummy.Raiser(ParseError))
00219         try:
00220             self.check('''
00221 from Products.ZCTextIndex.ParseTree import ParseError
00222 try: context.raiseParseError()
00223 except ParseError: pass
00224 ''')
00225         except Exception, e:
00226             self.fail('Failed to catch: %s %s (module %s)' %
00227                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 258 of file testSecurityDeclarations.py.

00258 
00259     def testCatch_SyntaxErrorRaisedByPythonModule(self):
00260         self.folder._setObject('raiseSyntaxError', dummy.Raiser(self.SyntaxError))
00261         try:
00262             self.check('''
00263 from DateTime.DateTime import SyntaxError
00264 try: context.raiseSyntaxError()
00265 except SyntaxError: pass
00266 ''')
00267         except Exception, e:
00268             self.fail('Failed to catch: %s %s (module %s)' %
00269                       (e.__class__.__name__, e, e.__module__))

Here is the call graph for this function:

Definition at line 353 of file testSecurityDeclarations.py.

00353 
00354     def testImport_AllowSendto(self):
00355         self.check('from Products.CMFPlone.PloneTool import AllowSendto')

Here is the call graph for this function:

Definition at line 140 of file testSecurityDeclarations.py.

00140 
00141     def testImport_base_hasattr(self):
00142         self.check('from Products.CMFPlone.utils import base_hasattr')

Here is the call graph for this function:

Definition at line 120 of file testSecurityDeclarations.py.

00120 
00121     def testImport_Batch(self):
00122         self.check('from Products.CMFPlone import Batch')

Here is the call graph for this function:

Definition at line 174 of file testSecurityDeclarations.py.

00174 
00175     def testImport_ConflictError(self):
00176         self.check('from ZODB.POSException import ConflictError')

Here is the call graph for this function:

Definition at line 270 of file testSecurityDeclarations.py.

00270 
00271     def testImport_CopyError(self):
00272         self.check('from OFS.CopySupport import CopyError')

Here is the call graph for this function:

Definition at line 230 of file testSecurityDeclarations.py.

00230 
00231     def testImport_DateTimeError(self):
00232         self.check('from DateTime.DateTime import DateTimeError')

Here is the call graph for this function:

Definition at line 289 of file testSecurityDeclarations.py.

00289 
00290     def testImport_DiscussionNotAllowed(self):
00291         self.check('from Products.CMFDefault.DiscussionTool '
00292                    'import DiscussionNotAllowed')

Here is the call graph for this function:

Definition at line 68 of file testSecurityDeclarations.py.

00068 
00069     def testImport_getLogger(self):
00070         self.check('from logging import getLogger')

Here is the call graph for this function:

Definition at line 329 of file testSecurityDeclarations.py.

00329 
00330     def testImport_getToolByName(self):
00331         self.check('from Products.CMFCore.utils import getToolByName')

Here is the call graph for this function:

Definition at line 76 of file testSecurityDeclarations.py.

00076 
00077     def testImport_IndexIterator(self):
00078         self.check('from Products.CMFPlone import IndexIterator')

Here is the call graph for this function:

Definition at line 320 of file testSecurityDeclarations.py.

00320 
00321         def testImport_isRTL(self):
00322             self.check('from Products.PlacelessTranslationService import isRTL')

Here is the call graph for this function:

Definition at line 47 of file testSecurityDeclarations.py.

00047 
00048     def testImport_log(self):
00049         self.check('from Products.CMFPlone.utils import log')

Here is the call graph for this function:

Definition at line 54 of file testSecurityDeclarations.py.

00054 
00055     def testImport_log_deprecated(self):
00056         self.check('from Products.CMFPlone.utils import log_deprecated')

Here is the call graph for this function:

Definition at line 61 of file testSecurityDeclarations.py.

00061 
00062     def testImport_log_exc(self):
00063         self.check('from Products.CMFPlone.utils import log_exc')

Here is the call graph for this function:

Definition at line 363 of file testSecurityDeclarations.py.

00363 
00364     def testImport_mergeResults(self):
00365         self.check('from Products.ZCatalog.Catalog import mergeResults')
00366 
00367 

Here is the call graph for this function:

Definition at line 98 of file testSecurityDeclarations.py.

00098 
00099     def testImport_ObjectDeleted(self):
00100         self.check('from Products.CMFCore.WorkflowCore import ObjectDeleted')

Here is the call graph for this function:

Definition at line 87 of file testSecurityDeclarations.py.

00087 
00088     def testImport_ObjectMoved(self):
00089         self.check('from Products.CMFCore.WorkflowCore import ObjectMoved')

Here is the call graph for this function:

Definition at line 209 of file testSecurityDeclarations.py.

00209 
00210     def testImport_ParseError(self):
00211         self.check('from Products.ZCTextIndex.ParseTree import ParseError')

Here is the call graph for this function:

Definition at line 317 of file testSecurityDeclarations.py.

00317 
00318         def testImport_PTS(self):
00319             self.check('from Products import PlacelessTranslationService')

Here is the call graph for this function:

Definition at line 154 of file testSecurityDeclarations.py.

00154 
00155     def testImport_safe_callable(self):
00156         self.check('from Products.CMFPlone.utils import safe_callable')

Here is the call graph for this function:

Definition at line 147 of file testSecurityDeclarations.py.

00147 
00148     def testImport_safe_hasattr(self):
00149         self.check('from Products.CMFPlone.utils import safe_hasattr')

Here is the call graph for this function:

Definition at line 251 of file testSecurityDeclarations.py.

00251 
00252     def testImport_SyntaxError(self):
00253         self.check('from DateTime.DateTime import SyntaxError')

Here is the call graph for this function:

Definition at line 344 of file testSecurityDeclarations.py.

00344 
00345     def testImport_transaction(self):
00346         self.checkUnauthorized('import transaction')

Here is the call graph for this function:

Definition at line 133 of file testSecurityDeclarations.py.

00133 
00134     def testImport_transaction_note(self):
00135         self.check('from Products.CMFPlone.utils import transaction_note')

Here is the call graph for this function:

Definition at line 163 of file testSecurityDeclarations.py.

00163 
00164     def testImport_Unauthorized(self):
00165         self.check('from AccessControl import Unauthorized')

Here is the call graph for this function:

Definition at line 109 of file testSecurityDeclarations.py.

00109 
00110     def testImport_WorkflowException(self):
00111         self.check('from Products.CMFCore.WorkflowCore import WorkflowException')

Here is the call graph for this function:

Definition at line 170 of file testSecurityDeclarations.py.

00170 
00171     def testImport_zExceptionsUnauthorized(self):
00172         # TODO: Note that this is not allowed
00173         self.checkUnauthorized('from zExceptions import Unauthorized')

Here is the call graph for this function:

Definition at line 181 of file testSecurityDeclarations.py.

00181 
00182     def testRaise_ConflictError(self):
00183         self.assertRaises(ConflictError,
00184             self.check, 'from ZODB.POSException import ConflictError;'
00185                         'raise ConflictError')

Here is the call graph for this function:

Definition at line 127 of file testSecurityDeclarations.py.

00127 
00128     def testUse_Batch(self):
00129         self.check('from Products.CMFPlone import Batch;'
00130                    'print Batch([], 0).nexturls')

Here is the call graph for this function:

Definition at line 337 of file testSecurityDeclarations.py.

00337 
00338     def testUse_getToolByName(self):
00339         self.app.manage_addFolder('portal_membership') # Fake a portal tool
00340         self.check('from Products.CMFCore.utils import getToolByName;'
00341                    'print getToolByName(context, "portal_membership")')

Here is the call graph for this function:

Definition at line 83 of file testSecurityDeclarations.py.

00083 
00084     def testUse_IndexIterator(self):
00085         self.check('from Products.CMFPlone import IndexIterator;'
00086                    'print IndexIterator().next')

Here is the call graph for this function:

Definition at line 105 of file testSecurityDeclarations.py.

00105 
00106     def testUse_ObjectDeleted(self):
00107         self.check('from Products.CMFCore.WorkflowCore import ObjectDeleted;'
00108                    'print ObjectDeleted().getResult')

Here is the call graph for this function:

Definition at line 94 of file testSecurityDeclarations.py.

00094 
00095     def testUse_ObjectMoved(self):
00096         self.check('from Products.CMFCore.WorkflowCore import ObjectMoved;'
00097                    'print ObjectMoved("foo").getResult')

Here is the call graph for this function:

Definition at line 347 of file testSecurityDeclarations.py.

00347 
00348     def testUse_transaction(self):
00349         self.checkUnauthorized('import transaction;'
00350                                'transaction.get()')

Here is the call graph for this function:

Definition at line 116 of file testSecurityDeclarations.py.

00116 
00117     def testUse_WorkflowException(self):
00118         self.check('from Products.CMFCore.WorkflowCore import WorkflowException;'
00119                    'print WorkflowException().args')

Here is the call graph for this function:


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