149 self.assertFalse(any(f for f in form.fields if f is None)) |
149 self.assertFalse(any(f for f in form.fields if f is None)) |
150 |
150 |
151 def test_attribute_add_permissions(self): |
151 def test_attribute_add_permissions(self): |
152 # https://www.cubicweb.org/ticket/4342844 |
152 # https://www.cubicweb.org/ticket/4342844 |
153 with self.admin_access.repo_cnx() as cnx: |
153 with self.admin_access.repo_cnx() as cnx: |
154 self.create_user(cnx, 'toto') |
154 self.create_user(cnx, u'toto') |
155 cnx.commit() |
155 cnx.commit() |
156 with self.new_access('toto').web_request() as req: |
156 with self.new_access(u'toto').web_request() as req: |
157 e = self.vreg['etypes'].etype_class('Personne')(req) |
157 e = self.vreg['etypes'].etype_class('Personne')(req) |
158 cform = self.vreg['forms'].select('edition', req, entity=e) |
158 cform = self.vreg['forms'].select('edition', req, entity=e) |
159 self.assertIn('sexe', |
159 self.assertIn('sexe', |
160 [rschema.type |
160 [rschema.type |
161 for rschema, _ in cform.editable_attributes()]) |
161 for rschema, _ in cform.editable_attributes()]) |
162 with self.new_access('toto').repo_cnx() as cnx: |
162 with self.new_access(u'toto').repo_cnx() as cnx: |
163 person_eid = cnx.create_entity('Personne', nom=u'Robert').eid |
163 person_eid = cnx.create_entity('Personne', nom=u'Robert').eid |
164 cnx.commit() |
164 cnx.commit() |
165 person = req.entity_from_eid(person_eid) |
165 person = req.entity_from_eid(person_eid) |
166 mform = self.vreg['forms'].select('edition', req, entity=person) |
166 mform = self.vreg['forms'].select('edition', req, entity=person) |
167 self.assertNotIn('sexe', |
167 self.assertNotIn('sexe', |