[entity/hooks] fix regression introduced by 4ba11607d84a
on create_entity, attributes weren't cached, but they are since 4ba11607d84a
and this triggered a bug: used values may be transformed by hooks (e.g.
TidyHtmlFields), ending in invalid value in the cache. This is the regression.
Now, set_attributes used to update the attributes cache while suffering from
the very same pb. This is the now fixed old bug.
Transformed attributes are now recorded in a transaction shared variable, and
those are omitted from the client cache.
from cubicweb.devtools import DEFAULT_SOURCES
LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
# Generated by the windmill services transformer
from windmill.authoring import WindmillTestClient
def test_connect():
client = WindmillTestClient(__name__)
client.open(url=u'/')
client.waits.forPageLoad(timeout=u'20000')
client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
client.type(text=LOGIN, id=u'__login')
client.type(text=PASSWORD, id=u'__password')
client.execJS(js=u"$('#loginForm').submit()")
client.waits.forPageLoad(timeout=u'20000')
client.waits.sleep(milliseconds=u'5000')
client.asserts.assertJS(js=u'$(\'.message\').text() == "welcome %s !"' % LOGIN)
client.open(url=u'/logout')
client.waits.forPageLoad(timeout=u'20000')
client.open(url=u'/')
client.waits.forPageLoad(timeout=u'20000')
client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
def test_wrong_connect():
client = WindmillTestClient(__name__)
client.open(url=u'/')
# XXX windmill wants to use its proxy internally on 403 :-(
#client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
#client.type(text=LOGIN, id=u'__login')
#client.type(text=u'novalidpassword', id=u'__password')
#client.click(value=u'log in')
client.open(url=u'/?__login=user&__password=nopassword')
client.waits.forPageLoad(timeout=u'20000')
client.asserts.assertTextIn(validator=u'authentication failure', id=u'loginBox')
client.open(url=u'/')
client.waits.forPageLoad(timeout=u'20000')
client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")