[web/data] fix treeview regression (closes #3526466)
Changeset 68cde7431c2c "[js] remove 3.9 bw compat (where apparently
unused)" removed the use of form.callback from loadxhtml, which treeview
relied on. Update to add a callback on the loadxhtml return value
instead.
# -*- coding: utf-8 -*-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""functional tests for core hooksNote: syncschema.py hooks are mostly tested in server/test/unittest_migrations.py"""fromcubicwebimportValidationErrorfromcubicweb.devtools.testlibimportCubicWebTCclassCWPropertyHooksTC(CubicWebTC):deftest_unexistant_cwproperty(self):withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop", X for_user U')cm.exception.translate(unicode)self.assertEqual(cm.exception.errors,{'pkey-subject':'unknown property key bla.bla'})withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "bla.bla", X value "hop"')cm.exception.translate(unicode)self.assertEqual(cm.exception.errors,{'pkey-subject':'unknown property key bla.bla'})deftest_site_wide_cwproperty(self):withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "ui.site-title", X value "hop", X for_user U')self.assertEqual(cm.exception.errors,{'for_user-subject':"site-wide property can't be set for user"})deftest_system_cwproperty(self):withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "system.version.cubicweb", X value "hop", X for_user U')self.assertEqual(cm.exception.errors,{'for_user-subject':"site-wide property can't be set for user"})deftest_bad_type_cwproperty(self):withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "ui.language", X value "hop", X for_user U')self.assertEqual(cm.exception.errors,{'value-subject':u'unauthorized value'})withself.assertRaises(ValidationError)ascm:self.execute('INSERT CWProperty X: X pkey "ui.language", X value "hop"')self.assertEqual(cm.exception.errors,{'value-subject':u'unauthorized value'})if__name__=='__main__':fromlogilab.common.testlibimportunittest_mainunittest_main()