52 wf.add_state(u'foo', initial=True) |
52 wf.add_state(u'foo', initial=True) |
53 self.commit() |
53 self.commit() |
54 wf.add_state(u'foo') |
54 wf.add_state(u'foo') |
55 with self.assertRaises(ValidationError) as cm: |
55 with self.assertRaises(ValidationError) as cm: |
56 self.commit() |
56 self.commit() |
57 self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a state of that name'}) |
57 self.assertEqual({'name-subject': 'workflow already has a state of that name'}, |
|
58 cm.exception.errors) |
58 # no pb if not in the same workflow |
59 # no pb if not in the same workflow |
59 wf2 = add_wf(self, 'Company') |
60 wf2 = add_wf(self, 'Company') |
60 foo = wf2.add_state(u'foo', initial=True) |
61 foo = wf2.add_state(u'foo', initial=True) |
61 self.commit() |
62 self.commit() |
62 # gnark gnark |
63 # gnark gnark |
63 bar = wf.add_state(u'bar') |
64 bar = wf.add_state(u'bar') |
64 self.commit() |
65 self.commit() |
65 bar.cw_set(name=u'foo') |
66 bar.cw_set(name=u'foo') |
66 with self.assertRaises(ValidationError) as cm: |
67 with self.assertRaises(ValidationError) as cm: |
67 self.commit() |
68 self.commit() |
68 self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a state of that name'}) |
69 self.assertEqual({'name-subject': 'workflow already has a state of that name'}, |
|
70 cm.exception.errors) |
69 |
71 |
70 def test_duplicated_transition(self): |
72 def test_duplicated_transition(self): |
71 wf = add_wf(self, 'Company') |
73 wf = add_wf(self, 'Company') |
72 foo = wf.add_state(u'foo', initial=True) |
74 foo = wf.add_state(u'foo', initial=True) |
73 bar = wf.add_state(u'bar') |
75 bar = wf.add_state(u'bar') |