entities/test/unittest_wfobjs.py
branch3.5
changeset 2983 b458631fe347
parent 2982 1768dbe8e9b3
child 2984 31c24caf6961
--- a/entities/test/unittest_wfobjs.py	Tue Aug 25 13:34:19 2009 +0200
+++ b/entities/test/unittest_wfobjs.py	Tue Aug 25 13:35:01 2009 +0200
@@ -103,6 +103,16 @@
         trinfo = self._test_manager_deactivate(user)
         self.assertEquals(trinfo.transition, None)
 
+    def test_set_in_state_bad_wf(self):
+        wf = add_wf(self, 'CWUser')
+        s = wf.add_state(u'foo', initial=True)
+        self.commit()
+        ex = self.assertRaises(ValidationError, self.session().unsafe_execute,
+                               'SET X in_state S WHERE X eid %(x)s, S eid %(s)s',
+                               {'x': self.user().eid, 's': s.eid}, 'x')
+        self.assertEquals(ex.errors, {'in_state': "state doesn't belong to entity's workflow. "
+                                      "You may want to set a custom workflow for this entity first."})
+
     def test_fire_transition(self):
         user = self.user()
         user.fire_transition('deactivate', comment=u'deactivate user')