web/test/unittest_form.py
changeset 2234 1fbcf202882d
parent 2181 94ca417b9b07
parent 2198 ac45d4dbaf76
child 2293 7ded2a1416e4
equal deleted inserted replaced
2209:2b91abd9f5a4 2234:1fbcf202882d
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 """
     7 """
       
     8 from __future__ import with_statement
     8 
     9 
     9 from xml.etree.ElementTree import fromstring
    10 from xml.etree.ElementTree import fromstring
    10 
    11 
    11 from logilab.common.testlib import unittest_main, mock_object
    12 from logilab.common.testlib import unittest_main, mock_object
    12 
    13 
    95         pageinfo = self._check_html(form.form_render(), form, template=None)
    96         pageinfo = self._check_html(form.form_render(), form, template=None)
    96         inputs = pageinfo.find_tag('select', False)
    97         inputs = pageinfo.find_tag('select', False)
    97         self.failUnless(any(attrs for t, attrs in inputs if attrs.get('name') == 'in_group:A'))
    98         self.failUnless(any(attrs for t, attrs in inputs if attrs.get('name') == 'in_group:A'))
    98         inputs = pageinfo.find_tag('input', False)
    99         inputs = pageinfo.find_tag('input', False)
    99         self.failIf(any(attrs for t, attrs in inputs if attrs.get('name') == '__linkto'))
   100         self.failIf(any(attrs for t, attrs in inputs if attrs.get('name') == '__linkto'))
       
   101 
       
   102     def test_reledit_composite_field(self):
       
   103         rset = self.execute('INSERT BlogEntry X: X title "cubicweb.org", X content "hop"')
       
   104         form = self.vreg.select_object('views', 'reledit', self.request(),
       
   105                                        rset=rset, row=0, rtype='content')
       
   106         data = form.render(row=0, rtype='content')
       
   107         self.failUnless('edits-content' in data)
       
   108         self.failUnless('edits-content_format' in data)
   100 
   109 
   101     # form view tests #########################################################
   110     # form view tests #########################################################
   102 
   111 
   103     def test_massmailing_formview(self):
   112     def test_massmailing_formview(self):
   104         self.execute('INSERT EmailAddress X: X address L + "@cubicweb.org", '
   113         self.execute('INSERT EmailAddress X: X address L + "@cubicweb.org", '