[CMF-checkins] CVS: CMF/CMFSetup/tests - test_typeinfo.py:1.10.8.1 test_workflow.py:1.24.8.1

Martijn Pieters mj at zopatista.com
Wed Nov 10 08:29:18 EST 2004


Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv15746/tests

Modified Files:
      Tag: mj-cmf14-compat-branch
	test_typeinfo.py test_workflow.py 
Log Message:
CMF-1.4 compatible version of CMFSetup.


=== CMF/CMFSetup/tests/test_typeinfo.py 1.10 => 1.10.8.1 ===
--- CMF/CMFSetup/tests/test_typeinfo.py:1.10	Thu Aug 12 11:07:41 2004
+++ CMF/CMFSetup/tests/test_typeinfo.py	Wed Nov 10 08:28:47 2004
@@ -110,7 +110,6 @@
                    , 'allowed_content_types'
                    , 'allow_discussion'
                    , 'global_allow'
-                   , 'aliases'
                    ):
             self.assertEqual( found[ key ], expected[ key ] )
 
@@ -156,7 +155,6 @@
                    , 'allowed_content_types'
                    , 'allow_discussion'
                    , 'global_allow'
-                   , 'aliases'
                    ):
             self.assertEqual( found[ key ], expected[ key ] )
 
@@ -307,7 +305,6 @@
         info = info_list[ 0 ]
         self.assertEqual( info[ 'id' ], 'foo' )
         self.assertEqual( info[ 'title' ], 'Foo' )
-        self.assertEqual( len( info[ 'aliases' ] ), 2 )
 
     def test_parseTypeXML_STI( self ):
 
@@ -322,7 +319,6 @@
         info = info_list[ 0 ]
         self.assertEqual( info[ 'id' ], 'bar' )
         self.assertEqual( info[ 'title' ], 'Bar' )
-        self.assertEqual( len( info[ 'aliases' ] ), 2 )
 
     def test_parseTypeXML_actions( self ):
 
@@ -354,9 +350,6 @@
              , 'allowed_content_types'  : ()
              , 'allow_discussion'       : False
              , 'global_allow'           : False
-             , 'aliases'                : { '(Default)' : 'foo_view'
-                                          , 'view'      : 'foo_view'
-                                          }
              , 'actions'        :
                 ( { 'id'            : 'view'
                   , 'name'          : 'View'
@@ -387,9 +380,6 @@
              , 'allowed_content_types'  : ( 'foo', )
              , 'allow_discussion'       : True
              , 'global_allow'           : True
-             , 'aliases'                : { '(Default)' : 'bar_view'
-                                          , 'view'      : 'bar_view'
-                                          }
              , 'actions'        :
                 ( { 'id'            : 'view'
                   , 'name'          : 'View'
@@ -458,10 +448,6 @@
    allow_discussion="False"
    global_allow="False" >
   <description>Foo things</description>
-  <aliases>
-   <alias from="(Default)" to="foo_view" />
-   <alias from="view" to="foo_view" />
-  </aliases>
   <action
      action_id="view"
      title="View"
@@ -507,10 +493,6 @@
    global_allow="True" >
   <description>Bar things</description>
   <allowed_content_type>foo</allowed_content_type>
-  <aliases>
-   <alias from="(Default)" to="bar_view" />
-   <alias from="view" to="bar_view" />
-  </aliases>
   <action
      action_id="view"
      title="View"


=== CMF/CMFSetup/tests/test_workflow.py 1.24 => 1.24.8.1 ===
--- CMF/CMFSetup/tests/test_workflow.py:1.24	Thu Aug 12 11:07:41 2004
+++ CMF/CMFSetup/tests/test_workflow.py	Wed Nov 10 08:28:47 2004
@@ -69,15 +69,14 @@
 
 class _GuardChecker:
 
-    def _genGuardProps( self, permissions, roles, groups, expr ):
+    def _genGuardProps( self, permissions, roles, expr ):
 
         return { 'guard_permissions'   : '; '.join( permissions )
                , 'guard_roles'         : '; '.join( roles )
-               , 'guard_groups'        : '; '.join( groups )
                , 'guard_expr'          : expr
                }
 
-    def _assertGuard( self, info, permissions, roles, groups, expr ):
+    def _assertGuard( self, info, permissions, roles, expr ):
 
         self.assertEqual( len( info[ 'guard_permissions' ] )
                         , len( permissions ) )
@@ -91,12 +90,6 @@
         for expected in roles:
             self.failUnless( expected in info[ 'guard_roles' ] )
 
-        self.assertEqual( len( info[ 'guard_groups' ] )
-                        , len( groups ) )
-
-        for expected in groups:
-            self.failUnless( expected in info[ 'guard_groups' ] )
-
         self.assertEqual( info[ 'guard_expr' ], expr )
 
 
@@ -125,7 +118,7 @@
             variable = dcworkflow.variables._getOb( id )
 
             ( descr, def_val, def_exp, for_cat, for_stat, upd_alw
-            ) = args[ :-4 ]
+            ) = args[ :-3 ]
 
             variable.setProperties( description=args[0]
                                   , default_value=args[1]
@@ -133,13 +126,11 @@
                                   , for_catalog=args[3]
                                   , for_status=args[4]
                                   , update_always=args[5]
-                                  , props=self._genGuardProps( *args[ -4: ] )
+                                  , props=self._genGuardProps( *args[ -3: ] )
                                   )
 
     def _initStates( self, dcworkflow ):
 
-        dcworkflow.groups = _WF_GROUPS
-
         for k, v in _WF_STATES.items():
 
             dcworkflow.states.addState( k )
@@ -159,12 +150,6 @@
                                    )
             faux_request = {}
 
-            for group_id, roles in v[ 4 ]:
-                for role in roles:
-                    faux_request[ '%s|%s' % ( group_id, role ) ] = True
-
-            state.setGroups( REQUEST=faux_request )
-
             for k, v in v[ 5 ].items():
                 state.addVariable( k, v )
 
@@ -184,7 +169,7 @@
                                     , actbox_name=v[ 6 ]
                                     , actbox_url=v[ 7 ]
                                     , actbox_category=v[ 8 ]
-                                    , props=self._genGuardProps( *v[ -4: ] )
+                                    , props=self._genGuardProps( *v[ -3: ] )
                                     )
 
             for k, v in v[ 9 ].items():
@@ -199,7 +184,7 @@
 
             worklist.title = v[ 0 ]
 
-            props=self._genGuardProps( *v[ -4: ] )
+            props=self._genGuardProps( *v[ -3: ] )
 
             for var_id, matches in v[ 2 ].items():
                 props[ 'var_match_%s' % var_id ] = ';'.join( matches )
@@ -320,7 +305,7 @@
             self.assertEqual( info[ 'for_status' ], expected[ 4 ] )
             self.assertEqual( info[ 'update_always' ], expected[ 5 ] )
 
-            self._assertGuard( info, *expected[ -4: ] )
+            self._assertGuard( info, *expected[ -3: ] )
 
     def test_getWorkflowInfo_dcworkflow_states( self ):
 
@@ -370,12 +355,6 @@
                 for ep_role in ep_roles:
                     self.failUnless( ep_role in fp[ 'roles' ] )
 
-            groups = info[ 'groups' ]
-            self.assertEqual( len( groups ), len( expected[ 4 ] ) )
-
-            for i in range( len( groups ) ):
-                self.assertEqual( groups[ i ], expected[ 4 ][ i ] )
-
             variables = info[ 'variables' ]
             self.assertEqual( len( variables ), len( expected[ 5 ] ) )
 
@@ -438,7 +417,7 @@
                 self.assertEqual( v_info[ 'expr' ]
                                 , expected[ 9 ][ v_info[ 'name' ] ] )
 
-            self._assertGuard( info, *expected[ -4: ] )
+            self._assertGuard( info, *expected[ -3: ] )
 
     def test_getWorkflowInfo_dcworkflow_worklists( self ):
 
@@ -481,7 +460,7 @@
                 for e_value in e_values:
                     self.failUnless( e_value in values )
 
-            self._assertGuard( info, *expected[ -4: ] )
+            self._assertGuard( info, *expected[ -3: ] )
 
     def test_getWorkflowInfo_dcworkflow_scripts( self ):
 
@@ -939,8 +918,6 @@
 
             self.assertEqual( tuple( state[ 'transitions' ] ), expected[ 2 ] )
             self.assertEqual( state[ 'permissions' ], expected[ 3 ] )
-            self.assertEqual( tuple( state[ 'groups' ] )
-                            , tuple( expected[ 4 ] ) )
 
             for k, v_info in state[ 'variables' ].items():
 
@@ -1019,9 +996,7 @@
                             , expected[ 10 ] )
             self.assertEqual( tuple( guard.get( 'roles', () ) )
                             , expected[ 11 ] )
-            self.assertEqual( tuple( guard.get( 'groups', () ) )
-                            , expected[ 12 ] )
-            self.assertEqual( guard.get( 'expression', '' ), expected[ 13 ] )
+            self.assertEqual( guard.get( 'expression', '' ), expected[ 12 ] )
 
     def test_parseWorkflowXML_normal_variables( self ):
 
@@ -1096,9 +1071,7 @@
                             , expected[ 6 ] )
             self.assertEqual( tuple( guard.get( 'roles', () ) )
                             , expected[ 7 ] )
-            self.assertEqual( tuple( guard.get( 'groups', () ) )
-                            , expected[ 8 ] )
-            self.assertEqual( guard.get( 'expression', '' ), expected[ 9 ] )
+            self.assertEqual( guard.get( 'expression', '' ), expected[ 8 ] )
 
     def test_parseWorkflowXML_normal_worklists( self ):
 
@@ -1157,9 +1130,7 @@
                             , expected[ 6 ] )
             self.assertEqual( tuple( guard.get( 'roles', () ) )
                             , expected[ 7 ] )
-            self.assertEqual( tuple( guard.get( 'groups', () ) )
-                            , expected[ 8 ] )
-            self.assertEqual( guard.get( 'expression', '' ), expected[ 9 ] )
+            self.assertEqual( guard.get( 'expression', '' ), expected[ 8 ] )
 
     def test_parseWorkflowXML_normal_permissions( self ):
 
@@ -1251,11 +1222,6 @@
 , 'Restore expired content'
 )
 
-_WF_GROUPS = \
-( 'Content_owners'
-, 'Content_assassins'
-)
-
 _WF_VARIABLES = \
 { 'when_opened':  ( 'Opened when'
                   , ''
@@ -1265,7 +1231,6 @@
                   , True
                   , ( 'Query history', 'Open content for modifications' )
                   , ()
-                  , ()
                   , ""
                   )
 , 'when_expired': ( 'Expired when'
@@ -1276,7 +1241,6 @@
                   , True
                   , ( 'Query history', 'Open content for modifications' )
                   , ()
-                  , ()
                   , ""
                   )
 , 'killed_by':    ( 'Killed by'
@@ -1287,7 +1251,6 @@
                   , True
                   , ()
                   , ( 'Hangman', 'Sherrif' )
-                  , ()
                   , ""
                   )
 }
@@ -1336,7 +1299,6 @@
              , { 'when_opened' : 'object/ZopeTime' }
              , ( 'Open content for modifications', )
              , ()
-             , ()
              , ""
              )
 , 'close':   ( 'Close'
@@ -1351,7 +1313,6 @@
              , {}
              , ()
              , ( 'Owner', 'Manager' )
-             , ()
              , ""
              )
 , 'kill':    ( 'Kill'
@@ -1366,7 +1327,6 @@
              , { 'killed_by' : 'string:${user/getId}' }
              , ()
              , ()
-             , ( 'Content_assassins', )
              , ""
              )
 , 'expire':  ( 'Expire'
@@ -1381,7 +1341,6 @@
              , { 'when_expired' : 'object/ZopeTime' }
              , ()
              , ()
-             , ()
              , "python: object.expiration() <= object.ZopeTime()"
              )
 }
@@ -1395,7 +1354,6 @@
                     , 'workflow'
                     , ( 'Restore expired content', )
                     , ()
-                    , ()
                     , ""
                     )
 , 'alive_list':     ( 'Alive'
@@ -1406,7 +1364,6 @@
                     , 'workflow'
                     , ( 'Restore expired content', )
                     , ()
-                    , ()
                     , ""
                     )
 }
@@ -1643,9 +1600,6 @@
    <permission-role>Owner</permission-role>
    <permission-role>Manager</permission-role>
   </permission-map>
-  <group-map name="Content_owners">
-   <group-role>Owner</group-role>
-  </group-map>
   <assignment
     name="is_closed"
     type="bool">False</assignment>
@@ -1695,7 +1649,6 @@
     category="workflow"
     url="string:${object_url}/kill_object">Kill</action>
   <guard>
-   <guard-group>Content_assassins</guard-group>
   </guard>
   <assignment
     name="killed_by">string:${user/getId}</assignment>
@@ -2136,8 +2089,7 @@
 
             self.assertEqual( guard.permissions, expected[ 6 ] )
             self.assertEqual( guard.roles, expected[ 7 ] )
-            self.assertEqual( guard.groups, expected[ 8 ] )
-            self.assertEqual( guard.getExprText(), expected[ 9 ] )
+            self.assertEqual( guard.getExprText(), expected[ 8 ] )
 
     def test_from_empty_dcworkflow_workflow_states( self ):
 
@@ -2178,17 +2130,6 @@
                 for role in p_info[ 'roles' ]:
                     self.failIf( role not in p_expected )
 
-            group_roles = state.group_roles or {}
-            self.assertEqual( len( group_roles ), len( expected[ 4 ] ) )
-
-            for group_id, exp_roles in expected[ 4 ]:
-
-                self.assertEqual( len( state.getGroupInfo( group_id ) )
-                                , len( exp_roles ) )
-
-                for role in state.getGroupInfo( group_id ):
-                    self.failUnless( role in exp_roles )
-
             self.assertEqual( len( state.getVariableValues() )
                             , len( expected[ 5 ] ) )
 
@@ -2235,8 +2176,7 @@
 
             self.assertEqual( guard.permissions, expected[ 10 ] )
             self.assertEqual( guard.roles, expected[ 11 ] )
-            self.assertEqual( guard.groups, expected[ 12 ] )
-            self.assertEqual( guard.getExprText(), expected[ 13 ] )
+            self.assertEqual( guard.getExprText(), expected[ 12 ] )
 
     def test_from_empty_dcworkflow_workflow_worklists( self ):
 
@@ -2277,8 +2217,7 @@
 
             self.assertEqual( guard.permissions, expected[ 6 ] )
             self.assertEqual( guard.roles, expected[ 7 ] )
-            self.assertEqual( guard.groups, expected[ 8 ] )
-            self.assertEqual( guard.getExprText(), expected[ 9 ] )
+            self.assertEqual( guard.getExprText(), expected[ 8 ] )
 
     def test_from_empty_dcworkflow_workflow_scripts( self ):
 



More information about the CMF-checkins mailing list