entities/test/unittest_wfobjs.py
changeset 9246 593b29325f68
parent 9242 564bdd4dbf8f
child 9582 46ed25d38fe2
equal deleted inserted replaced
9218:c027ed79f1ce 9246:593b29325f68
    73         bar = wf.add_state(u'bar')
    73         bar = wf.add_state(u'bar')
    74         wf.add_transition(u'baz', (foo,), bar, ('managers',))
    74         wf.add_transition(u'baz', (foo,), bar, ('managers',))
    75         wf.add_transition(u'baz', (bar,), foo)
    75         wf.add_transition(u'baz', (bar,), foo)
    76         with self.assertRaises(ValidationError) as cm:
    76         with self.assertRaises(ValidationError) as cm:
    77             self.commit()
    77             self.commit()
    78         self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a transition of that name'})
    78         self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already has a transition of that name'})
    79         # no pb if not in the same workflow
    79         # no pb if not in the same workflow
    80         wf2 = add_wf(self, 'Company')
    80         wf2 = add_wf(self, 'Company')
    81         foo = wf.add_state(u'foo', initial=True)
    81         foo = wf.add_state(u'foo', initial=True)
    82         bar = wf.add_state(u'bar')
    82         bar = wf.add_state(u'bar')
    83         wf.add_transition(u'baz', (foo,), bar, ('managers',))
    83         wf.add_transition(u'baz', (foo,), bar, ('managers',))
    86         biz = wf.add_transition(u'biz', (bar,), foo)
    86         biz = wf.add_transition(u'biz', (bar,), foo)
    87         self.commit()
    87         self.commit()
    88         biz.cw_set(name=u'baz')
    88         biz.cw_set(name=u'baz')
    89         with self.assertRaises(ValidationError) as cm:
    89         with self.assertRaises(ValidationError) as cm:
    90             self.commit()
    90             self.commit()
    91         self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a transition of that name'})
    91         self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already has a transition of that name'})
    92 
    92 
    93 
    93 
    94 class WorkflowTC(CubicWebTC):
    94 class WorkflowTC(CubicWebTC):
    95 
    95 
    96     def setup_database(self):
    96     def setup_database(self):