[CMF-checkins] CVS: CMF/CMFCore/tests - test_TypesTool.py:1.25
Yvo Schubbe
schubbe@web.de
Tue, 15 Jul 2003 11:51:20 -0400
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv9258/CMFCore/tests
Modified Files:
test_TypesTool.py
Log Message:
Merged yuppie-collector168-redo-branch:
- Un-hardwired manage_FTPget for 'text/html'. (Collector #168)
- Some cleanup.
=== CMF/CMFCore/tests/test_TypesTool.py 1.24 => 1.25 ===
--- CMF/CMFCore/tests/test_TypesTool.py:1.24 Fri Jul 4 03:58:51 2003
+++ CMF/CMFCore/tests/test_TypesTool.py Tue Jul 15 11:50:44 2003
@@ -57,8 +57,7 @@
self.acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
self.ttool = self.site._setObject( 'portal_types', TypesTool() )
fti = FTIDATA_DUMMY[0].copy()
- del fti['id']
- self.ttool._setObject( 'Dummy Content', apply( FTI, ('Dummy Content',), fti) )
+ self.ttool._setObject( 'Dummy Content', FTI(**fti) )
def test_processActions( self ):
"""
@@ -161,9 +160,9 @@
)
self.assertEqual( ti.immediate_view, 'foo_view' )
- def _makeAndSetInstance( self,id,**kw ):
+ def _makeAndSetInstance(self, id, **kw):
tool = self.tool
- t = apply( self._makeInstance, (id,), kw )
+ t = self._makeInstance(id, **kw)
tool._setObject(id,t)
return tool[id]
@@ -217,7 +216,7 @@
ti = self._makeInstance( 'Foo' )
self.failIf( ti.listActions() )
- ti = self._makeInstanceByFTIData(FTIDATA_ACTIONS)
+ ti = self._makeInstance( **FTIDATA_ACTIONS[0] )
actions = ti.listActions()
self.failUnless( actions )
@@ -248,7 +247,7 @@
, id( marker ) )
self.assertRaises( ValueError, ti.getActionById, 'view' )
- ti = self._makeInstanceByFTIData(FTIDATA_ACTIONS)
+ ti = self._makeInstance( **FTIDATA_ACTIONS[0] )
self.assertEqual( id( ti.getActionById( 'foo', marker ) )
, id( marker ) )
self.assertRaises( ValueError, ti.getActionById, 'foo' )
@@ -266,7 +265,7 @@
self.assertEqual( action, 'foo_slot' )
def test_MethodAliases_methods(self):
- ti = self._makeInstanceByFTIData(FTIDATA_CMF15)
+ ti = self._makeInstance( **FTIDATA_CMF15[0] )
self.assertEqual( ti.getMethodAliases(), FTIDATA_CMF15[0]['aliases'] )
self.assertEqual( ti.getMethodPath('view'), ('dummy_view',) )
self.assertEqual( ti.getMethodPath('view.html'), ('dummy_view',) )
@@ -315,7 +314,7 @@
def test_CMF13_content_migration(self):
# use old FTI Data
- ti = self._makeInstanceByFTIData(FTIDATA_CMF13)
+ ti = self._makeInstance( **FTIDATA_CMF13[0] )
self._checkContentTI(ti)
# simulate old FTI
@@ -323,7 +322,7 @@
self.failIf( hasattr(ti, '_aliases') )
ti._actions = FTIDATA_CMF13[0]['actions']
self.failUnless( isinstance( ti._actions[0], DictType ) )
-
+
# migrate FTI
ti.getMethodPath('view')
self._checkContentTI(ti)
@@ -331,7 +330,7 @@
def test_CMF13_folder_migration(self):
# use old FTI Data
- ti = self._makeInstanceByFTIData(FTIDATA_CMF13_FOLDER)
+ ti = self._makeInstance( **FTIDATA_CMF13_FOLDER[0] )
self._checkFolderTI(ti)
# simulate old FTI
@@ -339,7 +338,7 @@
self.failIf( hasattr(ti, '_aliases') )
ti._actions = FTIDATA_CMF13_FOLDER[0]['actions']
self.failUnless( isinstance( ti._actions[0], DictType ) )
-
+
# migrate FTI
ti.getMethodPath('view')
self._checkFolderTI(ti)
@@ -347,7 +346,7 @@
def test_CMF14_content_migration(self):
# use old FTI Data
- ti = self._makeInstanceByFTIData(FTIDATA_CMF14)
+ ti = self._makeInstance( **FTIDATA_CMF14[0] )
self._checkContentTI(ti)
# simulate old FTI
@@ -361,7 +360,7 @@
def test_CMF14_folder_migration(self):
# use old FTI Data
- ti = self._makeInstanceByFTIData(FTIDATA_CMF14_FOLDER)
+ ti = self._makeInstance( **FTIDATA_CMF14_FOLDER[0] )
self._checkFolderTI(ti)
# simulate old FTI
@@ -376,7 +375,7 @@
wanted = { 'view':('dummy_view',), 'mkdir':('dummy_mkdir',) }
# use old FTI Data
- ti = self._makeInstanceByFTIData(FTIDATA_CMF14_SPECIAL)
+ ti = self._makeInstance( **FTIDATA_CMF14_SPECIAL[0] )
self.assertEqual(ti._aliases, wanted)
# simulate old FTI
@@ -390,14 +389,8 @@
class FTIDataTests( TypeInfoTests ):
- def _makeInstance( self, id, **kw ):
- return apply( FTI, ( id, ), kw )
-
- def _makeInstanceByFTIData(self, ftidata):
- fti = ftidata[0].copy()
- id = fti['id']
- del fti['id']
- return apply( FTI, ( id, ), fti )
+ def _makeInstance(self, id, **kw):
+ return FTI(id, **kw)
def test_properties( self ):
ti = self._makeInstance( 'Foo' )
@@ -420,14 +413,8 @@
class STIDataTests( TypeInfoTests ):
- def _makeInstance( self, id, **kw ):
- return apply( STI, ( id, ), kw )
-
- def _makeInstanceByFTIData(self, ftidata):
- fti = ftidata[0].copy()
- id = fti['id']
- del fti['id']
- return apply( STI, ( id, ), fti )
+ def _makeInstance(self, id, **kw):
+ return STI(id, **kw)
def test_properties( self ):
ti = self._makeInstance( 'Foo' )
@@ -453,8 +440,8 @@
def setUp( self ):
noSecurityManager()
- def _makeInstance( self, id, **kw ):
- return apply( FTI, ( id, ), kw )
+ def _makeInstance(self, id, **kw):
+ return FTI(id, **kw)
def _makeFolder( self, fake_product=0 ):
return DummyFolder( fake_product )