hooks/test/unittest_syncschema.py
branchstable
changeset 4927 19fd1952ad63
parent 4840 c02a340cd1da
child 4930 9fcc9ae2aebe
child 4968 79d80cfaab6f
equal deleted inserted replaced
4926:626d31035662 4927:19fd1952ad63
   306                             'WHERE R name "use_email"')
   306                             'WHERE R name "use_email"')
   307         self.commit()
   307         self.commit()
   308         rset = req.execute('Any X WHERE X has_text "rick.roll"')
   308         rset = req.execute('Any X WHERE X has_text "rick.roll"')
   309         self.assertIn(req.user.eid, [item[0] for item in rset])
   309         self.assertIn(req.user.eid, [item[0] for item in rset])
   310 
   310 
       
   311     def test_update_constraint(self):
       
   312         rdef = self.schema['Transition'].rdef('type')
       
   313         cstr = rdef.constraint_by_type('StaticVocabularyConstraint')
       
   314         if not getattr(cstr, 'eid', None):
       
   315             self.skip('start me alone') # bug in schema reloading, constraint's eid not restored
       
   316         self.execute('SET X value %(v)s WHERE X eid %(x)s',
       
   317                      {'x': cstr.eid, 'v': u"u'normal', u'auto', u'new'"}, 'x')
       
   318         self.execute('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X '
       
   319                      'WHERE CT name %(ct)s, EDEF eid %(x)s',
       
   320                      {'ct': 'SizeConstraint', 'value': u'max=10', 'x': rdef.eid}, 'x')
       
   321         self.commit()
       
   322         cstr = rdef.constraint_by_type('StaticVocabularyConstraint')
       
   323         self.assertEquals(cstr.values, (u'normal', u'auto', u'new'))
       
   324         self.execute('INSERT Transition T: T name "hop", T type "new"')