[CMF-checkins] CVS: CMF/CMFCore/tests - test_PortalFolder.py:1.18 test_TypesTool.py:1.15
Florent Guillaume
fg@nuxeo.com
Fri, 5 Jul 2002 15:45:35 -0400
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv2727/CMFCore/tests
Modified Files:
test_PortalFolder.py test_TypesTool.py
Log Message:
Fixed the Types Tool so that TypeInformation's Title is decorrelated
from its Id (the old TypeInformation.Type() should not be used anymore).
The Id is what gets put in the "portal_type" attribute of a content
object, which one gets at using somecontent.getPortalTypeName(). The
Title is returned by somecontent.Type().
"portal_type" is now indexed, and in most cases should be used when
doing catalog queries instead of "Type". Note that when upgrading from
older versions this index will have to be added by hand (see
INSTALL.txt).
Fixed PortalFolder's filtering so that it correctly restricts itself to
the portal types allowed by the TypesTool (Tracker #483).
=== CMF/CMFCore/tests/test_PortalFolder.py 1.17 => 1.18 ===
types_tool._setObject( 'Folder'
, FTI( id='Folder'
+ , title='Folder or Directory'
, meta_type=PortalFolder.meta_type
, product='CMFCore'
, factory='manage_addPortalFolder'
@@ -50,7 +51,8 @@
self.failUnless( 'foo' in f.objectIds() )
foo = f.foo
self.assertEqual( foo.getId(), 'foo' )
- self.assertEqual( foo.Type(), 'Dummy' )
+ self.assertEqual( foo.getPortalTypeName(), 'Dummy' )
+ self.assertEqual( foo.Type(), 'Dummy Content' )
def test_invokeFactory_disallowed_type( self ):
@@ -235,6 +237,7 @@
types_tool = self.root.portal_types
types_tool._setObject( 'Folder'
, FTI( id='Folder'
+ , title='Folder or Directory'
, meta_type=PortalFolder.meta_type
, product='CMFCore'
, factory='manage_addPortalFolder'
@@ -243,6 +246,7 @@
)
types_tool._setObject( 'Grabbed'
, FTI( 'Grabbed'
+ , title='Grabbed Content'
, meta_type=PortalFolder.meta_type
, product='CMFCore'
, factory='manage_addPortalFolder'
@@ -251,7 +255,8 @@
# First, test default behavior
test.manage_addFolder( id='simple', title='Simple' )
- self.assertEqual( test.simple.Type(), 'Folder' )
+ self.assertEqual( test.simple.getPortalTypeName(), 'Folder' )
+ self.assertEqual( test.simple.Type(), 'Folder or Directory' )
self.assertEqual( test.simple.getId(), 'simple' )
self.assertEqual( test.simple.Title(), 'Simple' )
@@ -278,7 +283,8 @@
self.root.grabbed = Grabbed( test )
test.manage_addFolder( id='indirect', title='Indirect' )
- self.assertEqual( test.indirect.Type(), 'Grabbed' )
+ self.assertEqual( test.indirect.getPortalTypeName(), 'Grabbed' )
+ self.assertEqual( test.indirect.Type(), 'Grabbed Content' )
self.assertEqual( test.indirect.getId(), 'indirect' )
self.assertEqual( test.indirect.Title(), 'Indirect' )
=== CMF/CMFCore/tests/test_TypesTool.py 1.14 => 1.15 ===
)
self.assertEqual( ti.getId(), 'Foo' )
- self.assertEqual( ti.Type(), 'Foo' )
+ self.assertEqual( ti.Title(), 'Foo' )
self.assertEqual( ti.Description(), 'Description' )
self.assertEqual( ti.Metatype(), 'Foo' )
self.assertEqual( ti.getIcon(), 'foo.gif' )