[CMF-checkins] CVS: CMF/CMFCore/tests - test_TypesTool.py:1.16

Chris McDonough chrism@zope.com
Fri, 26 Jul 2002 12:38:06 -0400


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv8190/CMFCore/tests

Modified Files:
	test_TypesTool.py 
Log Message:
Changed isConstructionAllowed method to not mask construction errors.  Before this change was made, it was possible for isConstructionAllowed to raise Unauthorized, masking a situation in which the construction was not possible because a factory method didn't exist or was invalid.

We removed the raise_exc argument to isConstructionAllowed.  It was never part of the interface.  Now, isConstructionAllowed will never raise, and if there is an error during the checking of allow-ed-ness, it will be logged to the stupid log file.


=== CMF/CMFCore/tests/test_TypesTool.py 1.15 => 1.16 ===
         ti = self._makeInstance( 'foo' )
 
         self.failIf( ti.isConstructionAllowed( None ) )
-        self.failIf( ti.isConstructionAllowed( None, raise_exc=1 ) )
 
         ti = self._makeInstance( 'Foo'
                                , product='FooProduct'
@@ -292,8 +291,6 @@
                                )
 
         self.failIf( ti.isConstructionAllowed( None ) )
-        self.assertRaises( Exception, ti.isConstructionAllowed
-                         , None, raise_exc=1 )
 
     def test_isConstructionAllowed_wo_ProductFactory( self ):
 
@@ -301,11 +298,9 @@
 
         folder = self._makeFolder()
         self.failIf( ti.isConstructionAllowed( folder ) )
-        self.failIf( ti.isConstructionAllowed( folder, raise_exc=1 ) )
 
         folder = self._makeFolder( fake_product=1 )
         self.failIf( ti.isConstructionAllowed( folder ) )
-        self.failIf( ti.isConstructionAllowed( folder, raise_exc=1 ) )
 
     def test_isConstructionAllowed_wo_Security( self ):
 
@@ -316,8 +311,6 @@
         folder = self._makeFolder( fake_product=1 )
 
         self.failIf( ti.isConstructionAllowed( folder ) )
-        self.assertRaises( Unauthorized, ti.isConstructionAllowed
-                         , folder, raise_exc=1 )
 
 class FTIConstructionTests_w_Roles( TestCase ):
 
@@ -355,8 +348,6 @@
 
         newSecurityManager( None
                           , UserWithRoles( 'FooViewer' ).__of__( folder ) )
-        self.assertRaises( Unauthorized, ti.isConstructionAllowed
-                         , folder, raise_exc=1 )
 
     def test_constructInstance_wo_Roles( self ):