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