Back to index

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

List of all members.

Public Member Functions

def test_z2interfaces
def test_z3interfaces
def test_properties
def test_construction
def test_allowType
def test_GlobalHide
def test_allowDiscussion
def test_listActions
def test_MethodAliases_methods

Public Attributes

 tool

Private Member Functions

def _makeInstance

Detailed Description

Definition at line 320 of file test_TypesTool.py.


Member Function Documentation

def CMFCore.tests.test_TypesTool.FTIDataTests._makeInstance (   self,
  id,
  kw 
) [private]

Definition at line 322 of file test_TypesTool.py.

00322 
00323     def _makeInstance(self, id, **kw):
00324         from Products.CMFCore.TypesTool import FactoryTypeInformation
00325 
00326         return FactoryTypeInformation(id, **kw)

Here is the caller graph for this function:

Definition at line 241 of file test_TypesTool.py.

00241 
00242     def test_allowDiscussion( self ):
00243         ti = self._makeInstance( 'Foo' )
00244         self.failIf( ti.allowDiscussion() )
00245 
00246         ti = self._makeInstance( 'Foo', allow_discussion=1 )
00247         self.failUnless( ti.allowDiscussion() )

Here is the call graph for this function:

Definition at line 204 of file test_TypesTool.py.

00204 
00205     def test_allowType( self ):
00206         self.tool = self._makeTypesTool()
00207         ti = self._makeAndSetInstance( 'Foo' )
00208         self.failIf( ti.allowType( 'Foo' ) )
00209         self.failIf( ti.allowType( 'Bar' ) )
00210 
00211         ti = self._makeAndSetInstance( 'Foo2', allowed_content_types=( 'Bar', ) )
00212         self.failUnless( ti.allowType( 'Bar' ) )
00213 
00214         ti = self._makeAndSetInstance( 'Foo3', filter_content_types=0 )
00215         self.failUnless( ti.allowType( 'Foo3' ) )

Definition at line 180 of file test_TypesTool.py.

00180 
00181     def test_construction( self ):
00182         ti = self._makeInstance( 'Foo'
00183                                , description='Description'
00184                                , meta_type='Foo'
00185                                , icon='foo.gif'
00186                                )
00187         self.assertEqual( ti.getId(), 'Foo' )
00188         self.assertEqual( ti.Title(), 'Foo' )
00189         self.assertEqual( ti.Description(), 'Description' )
00190         self.assertEqual( ti.Metatype(), 'Foo' )
00191         self.assertEqual( ti.getIcon(), 'foo.gif' )
00192         self.assertEqual( ti.immediate_view, '' )
00193 
00194         ti = self._makeInstance( 'Foo'
00195                                , immediate_view='foo_view'
00196                                )
00197         self.assertEqual( ti.immediate_view, 'foo_view' )

Here is the call graph for this function:

Definition at line 216 of file test_TypesTool.py.

00216 
00217     def test_GlobalHide( self ):
00218         self.tool = self._makeTypesTool()
00219         tnf = self._makeAndSetInstance( 'Folder', filter_content_types=0)
00220         taf = self._makeAndSetInstance( 'Allowing Folder'
00221                                       , allowed_content_types=( 'Hidden'
00222                                                               ,'Not Hidden'))
00223         tih = self._makeAndSetInstance( 'Hidden', global_allow=0)
00224         tnh = self._makeAndSetInstance( 'Not Hidden')
00225         # make sure we're normally hidden but everything else is visible
00226         self.failIf     ( tnf.allowType( 'Hidden' ) )
00227         self.failUnless ( tnf.allowType( 'Not Hidden') )
00228         # make sure we're available where we should be
00229         self.failUnless ( taf.allowType( 'Hidden' ) )
00230         self.failUnless ( taf.allowType( 'Not Hidden') )
00231         # make sure we're available in a non-content-type-filtered type
00232         # where we have been explicitly allowed
00233         taf2 = self._makeAndSetInstance( 'Allowing Folder2'
00234                                        , allowed_content_types=( 'Hidden'
00235                                                                , 'Not Hidden'
00236                                                                )
00237                                        , filter_content_types=0
00238                                        )
00239         self.failUnless ( taf2.allowType( 'Hidden' ) )
00240         self.failUnless ( taf2.allowType( 'Not Hidden') )

Here is the call graph for this function:

Definition at line 248 of file test_TypesTool.py.

00248 
00249     def test_listActions( self ):
00250         ti = self._makeInstance( 'Foo' )
00251         self.failIf( ti.listActions() )
00252 
00253         ti = self._makeInstance( **FTIDATA_ACTIONS[0] )
00254         actions = ti.listActions()
00255         self.failUnless( actions )
00256 
00257         ids = [ x.getId() for x in actions ]
00258         self.failUnless( 'view' in ids )
00259         self.failUnless( 'edit' in ids )
00260         self.failUnless( 'objectproperties' in ids )
00261         self.failUnless( 'slot' in ids )
00262 
00263         names = [ x.Title() for x in actions ]
00264         self.failUnless( 'View' in names )
00265         self.failUnless( 'Edit' in names )
00266         self.failUnless( 'Object Properties' in names )
00267         self.failIf( 'slot' in names )
00268         self.failUnless( 'Slot' in names )
00269 
00270         visible = [ x.getId() for x in actions if x.getVisibility() ]
00271         self.failUnless( 'view' in visible )
00272         self.failUnless( 'edit' in visible )
00273         self.failUnless( 'objectproperties' in visible )
00274         self.failIf( 'slot' in visible )

Here is the call graph for this function:

Definition at line 275 of file test_TypesTool.py.

00275 
00276     def test_MethodAliases_methods(self):
00277         ti = self._makeInstance( **FTIDATA_CMF15[0] )
00278         self.assertEqual( ti.getMethodAliases(), FTIDATA_CMF15[0]['aliases'] )
00279         self.assertEqual( ti.queryMethodID('view'), 'dummy_view' )
00280         self.assertEqual( ti.queryMethodID('view.html'), 'dummy_view' )
00281 
00282         ti.setMethodAliases( ti.getMethodAliases() )
00283         self.assertEqual( ti.getMethodAliases(), FTIDATA_CMF15[0]['aliases'] )

Here is the call graph for this function:

Definition at line 342 of file test_TypesTool.py.

00342 
00343     def test_properties( self ):
00344         ti = self._makeInstance( 'Foo' )
00345         self.assertEqual( ti.product, '' )
00346         self.assertEqual( ti.factory, '' )
00347 
00348         ti = self._makeInstance( 'Foo'
00349                                , product='FooProduct'
00350                                , factory='addFoo'
00351                                )
00352         self.assertEqual( ti.product, 'FooProduct' )
00353         self.assertEqual( ti.factory, 'addFoo' )
00354 

Here is the call graph for this function:

Definition at line 327 of file test_TypesTool.py.

00327 
00328     def test_z2interfaces(self):
00329         from Interface.Verify import verifyClass
00330         from Products.CMFCore.interfaces.portal_types \
00331                 import ContentTypeInformation as ITypeInformation
00332         from Products.CMFCore.TypesTool import FactoryTypeInformation
00333 
00334         verifyClass(ITypeInformation, FactoryTypeInformation)

Definition at line 335 of file test_TypesTool.py.

00335 
00336     def test_z3interfaces(self):
00337         from zope.interface.verify import verifyClass
00338         from Products.CMFCore.interfaces import ITypeInformation
00339         from Products.CMFCore.TypesTool import FactoryTypeInformation
00340 
00341         verifyClass(ITypeInformation, FactoryTypeInformation)


Member Data Documentation

Definition at line 205 of file test_TypesTool.py.


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