entities/test/unittest_wfobjs.py
branchstable
changeset 3616 600ee58a1375
parent 3587 5b3725f315fc
child 3617 9036a8fbbd57
equal deleted inserted replaced
3615:4e289c2e4b33 3616:600ee58a1375
   155     def test_fire_transition_has_update_perm(self):
   155     def test_fire_transition_has_update_perm(self):
   156         self.execute('INSERT RQLExpression X: X exprtype "ERQLExpression", '
   156         self.execute('INSERT RQLExpression X: X exprtype "ERQLExpression", '
   157                      'X expression "U has_update_permission X", T condition X '
   157                      'X expression "U has_update_permission X", T condition X '
   158                      'WHERE T name "deactivate"')
   158                      'WHERE T name "deactivate"')
   159         self._test_stduser_deactivate()
   159         self._test_stduser_deactivate()
       
   160 
       
   161     def test_swf_fire_in_a_row(self):
       
   162         # sub-workflow
       
   163         subwf = add_wf(self, 'CWGroup', name='subworkflow')
       
   164         xsigning = subwf.add_state('xsigning', initial=True)
       
   165         xaborted = subwf.add_state('xaborted')
       
   166         xsigned = subwf.add_state('xsigned')
       
   167         xabort = subwf.add_transition('xabort', (xsigning,), xaborted)
       
   168         xsign = subwf.add_transition('xsign', (xsigning,), xsigning)
       
   169         xcomplete = subwf.add_transition('xcomplete', (xsigning,), xsigned,
       
   170                                          type=u'auto')
       
   171         # main workflow
       
   172         twf = add_wf(self, 'CWGroup', name='mainwf', default=True)
       
   173         created    = twf.add_state(_('created'), initial=True)
       
   174         identified = twf.add_state(_('identified'))
       
   175         released   = twf.add_state(_('released'))
       
   176         twf.add_wftransition(_('identify'), subwf, (created,),
       
   177                              [(xsigned, identified), (xaborted, created)])
       
   178         twf.add_wftransition(_('release'), subwf, (identified,),
       
   179                              [(xsigned, released), (xaborted, identified)])
       
   180         self.commit()
       
   181         group = self.add_entity('CWGroup', name=u'grp1')
       
   182         self.commit()
       
   183         for trans in ('identify', 'release'):
       
   184             group.fire_transition(trans)
   160 
   185 
   161     def test_subworkflow_base(self):
   186     def test_subworkflow_base(self):
   162         """subworkflow
   187         """subworkflow
   163 
   188 
   164         +-----------+  tr1   +-----------+
   189         +-----------+  tr1   +-----------+