def test_hidden_fields(self): api.portal.set_registry_record( 'ploneintranet.userprofile.hidden_fields', (u'first_name', u'last_name', ), ) form = UserProfileViewForm(self.profile1, self.request) form.update() fields = form.fields.keys() self.assertNotIn('first_name', fields) self.assertNotIn('last_name', fields)
def test_get_fields(self): form = UserProfileViewForm(self.profile1, self.request) form.update() fields = form.fields.keys() fields_for_template = get_fields_for_template(form) names = [x['name'] for x in fields_for_template] self.assertEqual(names, fields) mapping = dict([(x['name'], x) for x in fields_for_template]) email = mapping['email'] self.assertEqual(email['raw'], '*****@*****.**') self.assertEqual(email['label'], 'Email')