# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1236887190 -3600 # Node ID bcb81e7c41bc68cab955bd1954a8f2002184f002 # Parent c71997f514bad8cd4cac32d91f833b60095de212 fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs... diff -r c71997f514ba -r bcb81e7c41bc web/test/unittest_form.py --- a/web/test/unittest_form.py Thu Mar 12 20:45:39 2009 +0100 +++ b/web/test/unittest_form.py Thu Mar 12 20:46:30 2009 +0100 @@ -1,8 +1,12 @@ from logilab.common.testlib import unittest_main, mock_object from cubicweb import Binary from cubicweb.devtools.testlib import WebTest -from cubicweb.web.form import * -from cubicweb.web.views.baseforms import ChangeStateForm +from cubicweb.web.form import EntityFieldsForm, FormRenderer +from cubicweb.web.formfields import (IntField, StringField, RichTextField, + DateTimeField, DateTimePicker, + FileField, EditableFileField) +from cubicweb.web.formwidgets import PasswordInput +from cubicweb.web.views.workflow import ChangeStateForm class EntityFieldsFormTC(WebTest): @@ -45,8 +49,8 @@ # fields tests ############################################################ def _render_entity_field(self, name, form): + form.form_add_entity_hiddens(form.entity.e_schema) form.form_build_context({}) - form.form_add_entity_hiddens(form.entity.e_schema) return form.field_by_name(name).render(form, self.renderer) def _test_richtextfield(self, expected): @@ -56,20 +60,22 @@ content=u'
You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.
-''') +''' % {'eid': file.eid}) + def test_passwordfield(self): class PFForm(EntityFieldsForm): upassword = StringField(widget=PasswordInput) form = PFForm(self.req, redirect_path='perdu.com', entity=self.entity) self.assertTextEquals(self._render_entity_field('upassword', form), - ''' + '''