def assertUnauth(self, module, fromlist):
     try:
         guarded_import(module, fromlist=fromlist)
     except (Unauthorized, ImportError):
         # Passed the test.
         pass
     else:
         assert 0, ('Did not protect module instance %s, %s' %
                    (`module`, `fromlist`))
Beispiel #2
0
 def assertUnauth(self, module, fromlist):
     try:
         guarded_import(module, fromlist=fromlist)
     except (Unauthorized, ImportError):
         # Passed the test.
         pass
     else:
         assert 0, ('Did not protect module instance %s, %s' %
                    ( ` module `, ` fromlist `))
Beispiel #3
0
 def test_03_NewTempObject(self):
   # Products.ERP5Type.Document.newTempBase is another (not recommended) way
   # of creating temp objects
   import Products.ERP5Type.Document
   o = Products.ERP5Type.Document.newTempBase(self.portal, 'id')
   self.assertEqual(o.getId(), 'id')
   self.assertEqual(o.getPortalType(), 'Base Object')
   self.assertTrue(o.isTempObject())
   self.assertTrue(guarded_import("Products.ERP5Type.Document", fromlist=["newTempBase"]))
Beispiel #4
0
 def assertAuth(self, module, fromlist):
     from AccessControl.ZopeGuards import guarded_import
     guarded_import(module, fromlist=fromlist)
 def assertAuth(self, module, fromlist):
     try:
         guarded_import(module, fromlist=fromlist)
     except (Unauthorized, ImportError):
         assert 0, ('Did not expose module instance %s, %s' %
                    (`module`, `fromlist`))
 def assertAuth(self, module, fromlist, level=-1):
     from AccessControl.ZopeGuards import guarded_import
     guarded_import(module, fromlist=fromlist, level=level)
Beispiel #7
0
 def assertAuth(self, module, fromlist):
     try:
         guarded_import(module, fromlist=fromlist)
     except (Unauthorized, ImportError):
         assert 0, ('Did not expose module instance %s, %s' %
                    ( ` module `, ` fromlist `))