fix test: required to fake parent form stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 27 Nov 2009 22:04:54 +0100
branchstable
changeset 3930 c0ae3148b893
parent 3929 9f314411cd04
child 3931 882de7c1c247
fix test: required to fake parent form
web/test/unittest_views_editforms.py
web/views/editforms.py
--- a/web/test/unittest_views_editforms.py	Fri Nov 27 19:04:26 2009 +0100
+++ b/web/test/unittest_views_editforms.py	Fri Nov 27 22:04:54 2009 +0100
@@ -5,7 +5,7 @@
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
-from logilab.common.testlib import unittest_main
+from logilab.common.testlib import unittest_main, mock_object
 from logilab.common.compat import any
 from cubicweb.devtools.apptest import EnvBasedTC
 from cubicweb.devtools.testlib import WebTest
@@ -154,13 +154,16 @@
         geid = self.execute('CWGroup X LIMIT 1')[0][0]
         rset = self.execute('CWUser X LIMIT 1')
         self.view('inline-edition', rset, row=0, col=0, rtype='in_group',
-                  peid=geid, role='object', template=None, i18nctx='').source
+                  peid=geid, role='object', template=None, i18nctx='',
+                  pform=MOCKPFORM).source
 
     def test_automatic_inline_creation_formview(self):
         geid = self.execute('CWGroup X LIMIT 1')[0][0]
         self.view('inline-creation', None, etype='CWUser', rtype='in_group',
-                  peid=geid, template=None, i18nctx='', role='object').source
+                  peid=geid, template=None, i18nctx='', role='object',
+                  pform=MOCKPFORM).source
 
+MOCKPFORM = mock_object(form_previous_values={}, form_valerror=None)
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/views/editforms.py	Fri Nov 27 19:04:26 2009 +0100
+++ b/web/views/editforms.py	Fri Nov 27 22:04:54 2009 +0100
@@ -491,8 +491,9 @@
                                          entity=entity,
                                          form_renderer_id='inline',
                                          mainform=False, copy_nav_params=False,
+                                         parent_form=self.pform,
                                          **self.extra_kwargs)
-        form.parent_form = self.pform
+        #assert form.parent_form
         self.add_hiddens(form, entity)
         return form