[CMF-checkins] CVS: CMF/CMFCore/tests - test_ActionInformation.py:1.5 test_TypesTool.py:1.21

Yvo Schubbe schubbe@web.de
Fri, 9 May 2003 17:40:54 -0400


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

Modified Files:
	test_ActionInformation.py test_TypesTool.py 
Log Message:
Merged yuppie-collector152-branch:
- Made type actions absolute URLs by default. (Collector #152)

=== CMF/CMFCore/tests/test_ActionInformation.py 1.4 => 1.5 ===
--- CMF/CMFCore/tests/test_ActionInformation.py:1.4	Thu Apr 24 10:11:18 2003
+++ CMF/CMFCore/tests/test_ActionInformation.py	Fri May  9 17:40:23 2003
@@ -1,6 +1,12 @@
-import Zope
 from unittest import TestSuite, makeSuite, main
 
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+
 from Products.CMFCore.tests.base.testcase import \
      TransactionalTest
 
@@ -48,7 +54,7 @@
         self.assertEqual(ai.Title(), 'View')
         self.assertEqual(ai.Description(), '')
         self.assertEqual(ai.getCondition(), 'member')
-        self.assertEqual(ai.getActionExpression(), 'string:view')
+        self.assertEqual(ai.getActionExpression(), 'string:${object_url}/view')
         self.assertEqual(ai.getVisibility(), 0)
         self.assertEqual(ai.getCategory(), 'global')
         self.assertEqual(ai.getPermissions(), ())


=== CMF/CMFCore/tests/test_TypesTool.py 1.20 => 1.21 ===
--- CMF/CMFCore/tests/test_TypesTool.py:1.20	Tue Apr 15 12:08:02 2003
+++ CMF/CMFCore/tests/test_TypesTool.py	Fri May  9 17:40:23 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')