[CMF-checkins] CVS: CMF/CMFCore/tests - test_TypesTool.py:1.20.6.1
Yvo Schubbe
schubbe@web.de
Thu, 8 May 2003 07:21:44 -0400
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv22044/CMFCore/tests
Modified Files:
Tag: yuppie-collector152-branch
test_TypesTool.py
Log Message:
made "string:${object_url}/whatever_view" work (Collector #152)
=== CMF/CMFCore/tests/test_TypesTool.py 1.20 => 1.20.6.1 ===
--- CMF/CMFCore/tests/test_TypesTool.py:1.20 Tue Apr 15 12:08:02 2003
+++ CMF/CMFCore/tests/test_TypesTool.py Thu May 8 07:21:44 2003
@@ -1,6 +1,12 @@
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
+
import Zope
try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
+try:
from Interface.Verify import verifyClass
except ImportError:
# for Zope versions before 2.6.0
@@ -94,7 +100,7 @@
verifyClass(IActionProvider, TypesTool)
-class TypeInfoTests( unittest.TestCase ):
+class TypeInfoTests(TestCase):
def test_construction( self ):
ti = self._makeInstance( 'Foo'
@@ -169,13 +175,13 @@
ACTION_LIST = \
( { 'id' : 'view'
, 'name' : 'View'
- , 'action' : 'string:foo_view'
+ , 'action' : 'string:'
, 'permissions' : ( 'View', )
, 'category' : 'object'
, 'visible' : 1
}
, { 'name' : 'Edit' # Note: No ID passed
- , 'action' : 'string:foo_edit'
+ , 'action' : 'string:${object_url}/foo_edit'
, 'permissions' : ( 'Modify', )
, 'category' : 'object'
, 'visible' : 1
@@ -235,7 +241,7 @@
self.assertRaises( ValueError, ti.getActionById, 'foo' )
action = ti.getActionById( 'view' )
- self.assertEqual( action, 'foo_view' )
+ self.assertEqual( action, '' )
action = ti.getActionById( 'edit' )
self.assertEqual( action, 'foo_edit' )
@@ -269,7 +275,8 @@
self.failUnless( isinstance( action, ActionInformation ) )
self.assertEqual( action.getId(), 'bar' )
self.assertEqual( action.Title(), 'Bar' )
- self.assertEqual( action.getActionExpression(), 'string:bar_action' )
+ self.assertEqual( action.getActionExpression(),
+ 'string:${object_url}/bar_action' )
self.assertEqual( action.getCondition(), '' )
self.assertEqual( action.getPermissions(), ( 'Bar permission', ) )
self.assertEqual( action.getCategory(), 'baz' )
@@ -326,7 +333,7 @@
verifyClass(ITypeInformation, STI)
-class FTIConstructionTests( unittest.TestCase ):
+class FTIConstructionTests(TestCase):
def setUp( self ):
noSecurityManager()
@@ -370,7 +377,7 @@
self.failIf( ti.isConstructionAllowed( folder ) )
-class FTIConstructionTests_w_Roles( unittest.TestCase ):
+class FTIConstructionTests_w_Roles(TestCase):
def tearDown( self ):
noSecurityManager()
@@ -464,13 +471,13 @@
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TypesToolTests),
- unittest.makeSuite(FTIDataTests),
- unittest.makeSuite(STIDataTests),
- unittest.makeSuite(FTIConstructionTests),
- unittest.makeSuite(FTIConstructionTests_w_Roles),
+ return TestSuite((
+ makeSuite(TypesToolTests),
+ makeSuite(FTIDataTests),
+ makeSuite(STIDataTests),
+ makeSuite(FTIConstructionTests),
+ makeSuite(FTIConstructionTests_w_Roles),
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
+ main(defaultTest='test_suite')