fix some web tests, adjusts rtags tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 13 May 2009 17:21:35 +0200
branchtls-sprint
changeset 1797 c2a80130b06d
parent 1796 2cb2c96c82d9
child 1798 cc86fe8efaaa
fix some web tests, adjusts rtags
web/test/unittest_formfields.py
web/test/unittest_views_basecontrollers.py
web/test/unittest_views_editforms.py
web/test/unittest_viewselector.py
web/uicfg.py
--- a/web/test/unittest_formfields.py	Wed May 13 17:01:42 2009 +0200
+++ b/web/test/unittest_formfields.py	Wed May 13 17:21:35 2009 +0200
@@ -39,7 +39,7 @@
         description_format_field = guess_field(state_schema, schema['description_format'], skip_meta_attr=False)
         self.assertEquals(description_format_field.internationalizable, True)
         self.assertEquals(description_format_field.sort, True)
-        self.assertEquals(description_format_field.initial, 'text/rest')
+        self.assertEquals(description_format_field.initial(None), 'text/rest')
 
 #         wikiid_field = guess_field(state_schema, schema['wikiid'])
 #         self.assertIsInstance(wikiid_field, StringField)
--- a/web/test/unittest_views_basecontrollers.py	Wed May 13 17:01:42 2009 +0200
+++ b/web/test/unittest_views_basecontrollers.py	Wed May 13 17:21:35 2009 +0200
@@ -531,6 +531,7 @@
                            pageid='123', fname='view')
         ctrl = self.ctrl(req)
         rset = self.john.as_rset()
+        rset.req = req
         self.assertTextEquals(ctrl.publish(),
                               xhtml_wrap(ctrl.view('primary', rset)))
 
--- a/web/test/unittest_views_editforms.py	Wed May 13 17:01:42 2009 +0200
+++ b/web/test/unittest_views_editforms.py	Wed May 13 17:21:35 2009 +0200
@@ -9,13 +9,13 @@
 class AutomaticEntityFormTC(EnvBasedTC):
 
     def test_custom_widget(self):
-        AEF.rwidgets.tag_subject_of(('CWUser', 'login', '*'),
-                                    AutoCompletionWidget)
+        AEF.rfields_kwargs.tag_subject_of(('CWUser', 'login', '*'),
+                                          {'widget':AutoCompletionWidget})
         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('!CWUser', 'login', '*')
+        AEF.rfields_kwargs.del_rtag('CWUser', 'login', '*', 'subject')
 
 
     def test_euser_relations_by_category(self):
@@ -44,13 +44,13 @@
                                ('bookmarked_by', 'object'),
                                ])
         self.assertListEquals(rbc(e, 'generic'),
-                              [('connait', 'subject'),
+                              [('primary_email', 'subject'),
+                               ('connait', 'subject'),
                                ('checked_by', 'object'),
                                ])
         # owned_by is defined both as subject and object relations on CWUser
         self.assertListEquals(rbc(e, 'generated'),
-                              [('primary_email', 'subject'),
-                               ('use_email', 'subject'),
+                              [('use_email', 'subject'),
                                ('has_text', 'subject'),
                                ('identity', 'subject'),
                                ('is', 'subject'),
--- a/web/test/unittest_viewselector.py	Wed May 13 17:01:42 2009 +0200
+++ b/web/test/unittest_viewselector.py	Wed May 13 17:21:35 2009 +0200
@@ -165,7 +165,7 @@
                               ('list', baseviews.ListView),
                               ('oneline', baseviews.OneLineView),
                               ('owlabox', owl.OWLABOXView),
-                              ('primary', cwuser.CWUserPrimaryView),
+                              ('primary', primary.PrimaryView),
                               ('rsetxml', xmlrss.XMLRsetView),
                               ('rss', xmlrss.RSSView),
                               ('secondary', baseviews.SecondaryView),
@@ -326,12 +326,6 @@
                               self.vreg.select_view, 'creation', req, rset)
         self.assertIsInstance(self.vreg.select_view('table', req, rset),
                               tableview.TableView)
-        # cwuser primary view priority
-        rset, req = self.env.get_rset_and_req('CWUser X WHERE X login "admin"')
-        self.assertIsInstance(self.vreg.select_view('primary', req, rset),
-                             cwuser.CWUserPrimaryView)
-        self.assertIsInstance(self.vreg.select_view('text', req, rset),
-                             baseviews.TextView)
 
     def test_interface_selector(self):
         image = self.add_entity('Image', name=u'bim.png', data=Binary('bim'))
--- a/web/uicfg.py	Wed May 13 17:01:42 2009 +0200
+++ b/web/uicfg.py	Wed May 13 17:21:35 2009 +0200
@@ -212,6 +212,8 @@
 autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'generated')
 autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata')
 autoform_section.tag_attribute(('Bookmark', 'path'), 'primary')
+autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually
+autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic')
 
 
 # relations'field class