hooks/test/unittest_syncschema.py
changeset 4930 9fcc9ae2aebe
parent 4845 dc351b96f596
parent 4927 19fd1952ad63
child 4984 6cb91be7707f
equal deleted inserted replaced
4929:84684417beb9 4930:9fcc9ae2aebe
   291                             'WHERE R name "use_email"')
   291                             'WHERE R name "use_email"')
   292         self.commit()
   292         self.commit()
   293         rset = req.execute('Any X WHERE X has_text "rick.roll"')
   293         rset = req.execute('Any X WHERE X has_text "rick.roll"')
   294         self.assertIn(req.user.eid, [item[0] for item in rset])
   294         self.assertIn(req.user.eid, [item[0] for item in rset])
   295 
   295 
       
   296     def test_update_constraint(self):
       
   297         rdef = self.schema['Transition'].rdef('type')
       
   298         cstr = rdef.constraint_by_type('StaticVocabularyConstraint')
       
   299         if not getattr(cstr, 'eid', None):
       
   300             self.skip('start me alone') # bug in schema reloading, constraint's eid not restored
       
   301         self.execute('SET X value %(v)s WHERE X eid %(x)s',
       
   302                      {'x': cstr.eid, 'v': u"u'normal', u'auto', u'new'"}, 'x')
       
   303         self.execute('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X '
       
   304                      'WHERE CT name %(ct)s, EDEF eid %(x)s',
       
   305                      {'ct': 'SizeConstraint', 'value': u'max=10', 'x': rdef.eid}, 'x')
       
   306         self.commit()
       
   307         cstr = rdef.constraint_by_type('StaticVocabularyConstraint')
       
   308         self.assertEquals(cstr.values, (u'normal', u'auto', u'new'))
       
   309         self.execute('INSERT Transition T: T name "hop", T type "new"')