web/test/unittest_views_editforms.py
branchtls-sprint
changeset 1533 bcd4bfff658b
parent 1398 5fe84a5f7035
child 1540 996355824825
--- a/web/test/unittest_views_editforms.py	Wed Apr 29 09:27:03 2009 +0200
+++ b/web/test/unittest_views_editforms.py	Wed Apr 29 10:29:03 2009 +0200
@@ -9,13 +9,14 @@
 class AutomaticEntityFormTC(EnvBasedTC):
 
     def test_custom_widget(self):
-        AEF.rwidgets.set_rtag(AutoCompletionWidget, 'login', 'subject', 'CWUser')
+        AEF.rwidgets.tag_relation(AutoCompletionWidget,
+                                  ('CWUser', 'login', '*'), 'subject')
         form = self.vreg.select_object('forms', 'edition', self.request(), None,
                                        entity=self.user())
         field = form.field_by_name('login')
         self.assertIsInstance(field.widget, AutoCompletionWidget)
         AEF.rwidgets.del_rtag('login', 'subject', 'CWUser')
-        
+
 
     def test_euser_relations_by_category(self):
         #for (rtype, role, stype, otype), tag in AEF.rcategories._tagdefs.items():
@@ -41,7 +42,7 @@
                                ('modification_date', 'subject'),
                                ('owned_by', 'subject'),
                                ('bookmarked_by', 'object'),
-                               ])        
+                               ])
         self.assertListEquals(rbc(e, 'generic'),
                               [('primary_email', 'subject'),
                                ('use_email', 'subject'),
@@ -65,7 +66,7 @@
     def test_inlined_view(self):
         self.failUnless(AEF.rinlined.etype_rtag('CWUser', 'use_email', 'subject'))
         self.failIf(AEF.rinlined.etype_rtag('CWUser', 'primary_email', 'subject'))
-        
+
     def test_personne_relations_by_category(self):
         e = self.etype_instance('Personne')
         self.assertListEquals(rbc(e, 'primary'),
@@ -91,7 +92,7 @@
                                ('creation_date', 'subject'),
                                ('modification_date', 'subject'),
                                ('owned_by', 'subject'),
-                               ])        
+                               ])
         self.assertListEquals(rbc(e, 'generic'),
                               [('travaille', 'subject'),
                                ('connait', 'object')
@@ -103,7 +104,7 @@
                                ('is_instance_of', 'subject'),
                                ('identity', 'object'),
                                ])
-        
+
     def test_edition_form(self):
         rset = self.execute('CWUser X LIMIT 1')
         form = self.vreg.select_object('forms', 'edition', rset.req, rset,
@@ -112,41 +113,41 @@
         self.vreg.select_object('forms', 'edition', self.request(), None,
                                 entity=rset.get_entity(0, 0))
         self.failIf(any(f for f in form.fields if f is None))
-        
-        
+
+
 class FormViewsTC(WebTest):
     def test_delete_conf_formview(self):
         rset = self.execute('CWGroup X')
         self.view('deleteconf', rset, template=None).source
-        
+
     def test_automatic_edition_formview(self):
         rset = self.execute('CWUser X')
         self.view('edition', rset, row=0, template=None).source
-        
+
     def test_automatic_edition_formview(self):
         rset = self.execute('CWUser X')
         self.view('copy', rset, row=0, template=None).source
-        
+
     def test_automatic_creation_formview(self):
         self.view('creation', None, etype='CWUser', template=None).source
-        
+
     def test_automatic_muledit_formview(self):
         rset = self.execute('CWUser X')
         self.view('muledit', rset, template=None).source
-        
+
     def test_automatic_reledit_formview(self):
         rset = self.execute('CWUser X')
         self.view('reledit', rset, row=0, rtype='login', template=None).source
-        
+
     def test_automatic_inline_edit_formview(self):
         geid = self.execute('CWGroup X LIMIT 1')[0][0]
         rset = self.execute('CWUser X LIMIT 1')
         self.view('inline-edition', rset, row=0, rtype='in_group', peid=geid, template=None).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).source
 
-        
+
 if __name__ == '__main__':
     unittest_main()