--- a/cubicweb/web/test/unittest_views_forms.py Thu Jan 19 14:53:05 2017 +0100
+++ b/cubicweb/web/test/unittest_views_forms.py Fri Jan 20 10:31:04 2017 +0100
@@ -20,6 +20,8 @@
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.web.views.autoform import InlinedFormField
+from cubicweb.web.views.forms import EntityFieldsForm
+
class InlinedFormTC(CubicWebTC):
@@ -68,6 +70,20 @@
InlinedFormField(view=formview)])
self.assertTrue(formview._get_removejs())
+ def test_field_by_name_consider_aff(self):
+ class MyField(object):
+ def __init__(self, *args, **kwargs):
+ pass
+
+ EntityFieldsForm.uicfg_aff.tag_attribute(('CWUser', 'firstname'), MyField)
+ try:
+ with self.admin_access.web_request() as req:
+ form = req.vreg['forms'].select('base', req, entity=req.user)
+ self.assertIsInstance(form.field_by_name('firstname', 'subject', req.user.e_schema),
+ MyField)
+ finally:
+ EntityFieldsForm.uicfg_aff.del_rtag('CWUser', 'firstname', '*', 'subject')
+
if __name__ == '__main__':
import unittest