entities/test/unittest_wfobjs.py
branch3.5
changeset 2985 79185b3ccf2c
parent 2984 31c24caf6961
child 2992 a5b8bf107a1a
equal deleted inserted replaced
2984:31c24caf6961 2985:79185b3ccf2c
   210                      {'wf': wf.eid, 'x': self.member.eid})
   210                      {'wf': wf.eid, 'x': self.member.eid})
   211         ex = self.assertRaises(ValidationError, self.commit)
   211         ex = self.assertRaises(ValidationError, self.commit)
   212         self.assertEquals(ex.errors, {'custom_workflow': u'workflow has no initial state'})
   212         self.assertEquals(ex.errors, {'custom_workflow': u'workflow has no initial state'})
   213 
   213 
   214     def test_custom_wf_bad_etype(self):
   214     def test_custom_wf_bad_etype(self):
   215         """try to set a custom workflow which has no initial state"""
   215         """try to set a custom workflow which doesn't apply to entity type"""
   216         self.member.fire_transition('deactivate')
       
   217         wf = add_wf(self, 'Company')
   216         wf = add_wf(self, 'Company')
   218         wf.add_state('asleep', initial=True)
   217         wf.add_state('asleep', initial=True)
   219         self.execute('SET X custom_workflow WF WHERE X eid %(x)s, WF eid %(wf)s',
   218         self.execute('SET X custom_workflow WF WHERE X eid %(x)s, WF eid %(wf)s',
   220                      {'wf': wf.eid, 'x': self.member.eid})
   219                      {'wf': wf.eid, 'x': self.member.eid})
   221         ex = self.assertRaises(ValidationError, self.commit)
   220         ex = self.assertRaises(ValidationError, self.commit)