web/test/unittest_views_editforms.py
changeset 2661 f8df42c9da6b
parent 2643 9976f511003b
child 2773 b2530e3e0afb
child 2920 64322aa83a1d
equal deleted inserted replaced
2660:0d0924d75849 2661:f8df42c9da6b
    16 class AutomaticEntityFormTC(EnvBasedTC):
    16 class AutomaticEntityFormTC(EnvBasedTC):
    17 
    17 
    18     def test_custom_widget(self):
    18     def test_custom_widget(self):
    19         AEF.rfields_kwargs.tag_subject_of(('CWUser', 'login', '*'),
    19         AEF.rfields_kwargs.tag_subject_of(('CWUser', 'login', '*'),
    20                                           {'widget': AutoCompletionWidget(autocomplete_initfunc='get_logins')})
    20                                           {'widget': AutoCompletionWidget(autocomplete_initfunc='get_logins')})
    21         form = self.vreg.select('forms', 'edition', self.request(),
    21         form = self.vreg['forms'].select('edition', self.request(),
    22                                 entity=self.user())
    22                                          entity=self.user())
    23         field = form.field_by_name('login')
    23         field = form.field_by_name('login')
    24         self.assertIsInstance(field.widget, AutoCompletionWidget)
    24         self.assertIsInstance(field.widget, AutoCompletionWidget)
    25         AEF.rfields_kwargs.del_rtag('CWUser', 'login', '*', 'subject')
    25         AEF.rfields_kwargs.del_rtag('CWUser', 'login', '*', 'subject')
    26 
    26 
    27 
    27 
   114                                ('identity', 'object'),
   114                                ('identity', 'object'),
   115                                ])
   115                                ])
   116 
   116 
   117     def test_edition_form(self):
   117     def test_edition_form(self):
   118         rset = self.execute('CWUser X LIMIT 1')
   118         rset = self.execute('CWUser X LIMIT 1')
   119         form = self.vreg.select('forms', 'edition', rset.req, rset=rset,
   119         form = self.vreg['forms'].select('edition', rset.req, rset=rset,
   120                                 row=0, col=0)
   120                                 row=0, col=0)
   121         # should be also selectable by specifying entity
   121         # should be also selectable by specifying entity
   122         self.vreg.select('forms', 'edition', rset.req,
   122         self.vreg['forms'].select('edition', rset.req,
   123                          entity=rset.get_entity(0, 0))
   123                          entity=rset.get_entity(0, 0))
   124         self.failIf(any(f for f in form.fields if f is None))
   124         self.failIf(any(f for f in form.fields if f is None))
   125 
   125 
   126 
   126 
   127 class FormViewsTC(WebTest):
   127 class FormViewsTC(WebTest):