test updates tls-sprint
authorsylvain.thenault@logilab.fr
Mon, 04 May 2009 15:49:36 +0200
branchtls-sprint
changeset 1654 57b9fd2462b8
parent 1653 8b82227719f0
child 1655 b9b59e7239ab
test updates
web/test/unittest_controller.py
web/test/unittest_form.py
web/test/unittest_formfields.py
web/test/unittest_magicsearch.py
web/test/unittest_urlpublisher.py
web/test/unittest_views_basecontrollers.py
web/test/unittest_views_baseviews.py
web/test/unittest_views_editforms.py
web/test/unittest_viewselector.py
--- a/web/test/unittest_controller.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_controller.py	Mon May 04 15:49:36 2009 +0200
@@ -9,13 +9,22 @@
 from cubicweb.devtools import apptest
 
 class BaseControllerTC(apptest.ControllerTC):
-    def test_parse_datetime(self):
-        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24 12:18'), datetime)
-        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24'), datetime)
-        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24 12:18', 'Datetime'), datetime)
-        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24', 'Datetime'), datetime)
-        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24', 'Date'), date)
-        self.assertIsInstance(self.ctrl.parse_datetime('12:18', 'Time'), time)
+
+    def test_parse_datetime_ok(self):
+        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24 12:18'),
+                              datetime)
+        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24'),
+                              date)
+        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24 12:18', 'Datetime'),
+                              datetime)
+        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24', 'Datetime'),
+                              datetime)
+        self.assertIsInstance(self.ctrl.parse_datetime('2006/06/24', 'Date'),
+                              date)
+        self.assertIsInstance(self.ctrl.parse_datetime('12:18', 'Time'),
+                              time)
+
+    def test_parse_datetime_ko(self):
         self.assertRaises(ValueError,
                           self.ctrl.parse_datetime, '2006/06/24 12:188', 'Datetime')
         self.assertRaises(ValueError,
@@ -28,6 +37,6 @@
                           self.ctrl.parse_datetime, '2006/06/240', 'Date')
         self.assertRaises(ValueError,
                           self.ctrl.parse_datetime, '12:188', 'Time')
-        
+
 if __name__ == '__main__':
     unittest_main()
--- a/web/test/unittest_form.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_form.py	Mon May 04 15:49:36 2009 +0200
@@ -108,35 +108,35 @@
 
     def test_richtextfield_1(self):
         self.req.use_fckeditor = lambda: False
-        self._test_richtextfield('''<select name="description_format:%(eid)s" size="1" id="description_format:%(eid)s" tabindex="0">
+        self._test_richtextfield('''<select id="description_format:%(eid)s" name="description_format:%(eid)s" size="1" tabindex="0">
 <option value="text/cubicweb-page-template">text/cubicweb-page-template</option>
 <option value="text/html">text/html</option>
 <option value="text/plain">text/plain</option>
 <option selected="selected" value="text/rest">text/rest</option>
-</select><textarea rows="5" name="description:564" onkeypress="autogrow(this)" cols="60" id="description:564" tabindex="1"/>''')
+</select><textarea cols="60" id="description:%(eid)s" name="description:%(eid)s" onkeypress="autogrow(this)" rows="5" tabindex="1"/>''')
 
 
     def test_richtextfield_2(self):
         self.req.use_fckeditor = lambda: True
-        self._test_richtextfield('<input type="hidden" name="description_format:%(eid)s" value="text/rest"/><textarea rows="20" name="description:564" onkeypress="autogrow(this)" cols="80" cubicweb:type="wysiwyg" id="description:564" tabindex="0"/>')
+        self._test_richtextfield('<input name="description_format:%(eid)s" type="hidden" value="text/rest"/><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeypress="autogrow(this)" rows="20" tabindex="0"/>')
 
 
     def test_filefield(self):
         class FFForm(EntityFieldsForm):
             data = FileField(format_field=StringField(name='data_format'),
                              encoding_field=StringField(name='data_encoding'))
-        file = self.add_entity('File', name=u"pouet.txt",
+        file = self.add_entity('File', name=u"pouet.txt", data_encoding=u'UTF-8',
                                data=Binary('new widgets system'))
         form = FFForm(self.req, redirect_path='perdu.com', entity=file)
         self.assertTextEquals(self._render_entity_field('data', form),
-                              '''<input id="data:%(eid)s" type="file" name="data:%(eid)s" value="" tabindex="0"/>
+                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""/>
 <a href="javascript: toggleVisibility(&#39;data:%(eid)s-advanced&#39;)" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
 <div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" type="text" name="data_format:%(eid)s" value="text/plain" tabindex="1"/><br/><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" type="text" name="data_encoding:%(eid)s" value="UTF-8" tabindex="2"/><br/><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" name="data_format:%(eid)s" tabindex="1" type="text" value="text/plain"/><br/><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" name="data_encoding:%(eid)s" tabindex="2" type="text" value="UTF-8"/><br/><br/>
 </div>
 <br/>
-<input type="checkbox" name="data:%(eid)s__detach"/>
+<input name="data:%(eid)s__detach" type="checkbox"/>
 detach attached file
 ''' % {'eid': file.eid})
 
@@ -149,21 +149,21 @@
                 return 'ascii'
             def form_field_format(self, field):
                 return 'text/plain'
-        file = self.add_entity('File', name=u"pouet.txt",
+        file = self.add_entity('File', name=u"pouet.txt", data_encoding=u'UTF-8', 
                                data=Binary('new widgets system'))
         form = EFFForm(self.req, redirect_path='perdu.com', entity=file)
         self.assertTextEquals(self._render_entity_field('data', form),
-                              '''<input id="data:%(eid)s" type="file" name="data:%(eid)s" value="" tabindex="0"/>
+                              '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""/>
 <a href="javascript: toggleVisibility(&#39;data:%(eid)s-advanced&#39;)" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
 <div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" type="text" name="data_format:%(eid)s" value="text/plain" tabindex="1"/><br/><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" type="text" name="data_encoding:%(eid)s" value="UTF-8" tabindex="2"/><br/><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" name="data_format:%(eid)s" tabindex="1" type="text" value="text/plain"/><br/><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" name="data_encoding:%(eid)s" tabindex="2" type="text" value="UTF-8"/><br/><br/>
 </div>
 <br/>
-<input type="checkbox" name="data:%(eid)s__detach"/>
+<input name="data:%(eid)s__detach" type="checkbox"/>
 detach attached file
 <p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p>
-<textarea tabindex="3" rows="20" cols="80" name="data:%(eid)s" onkeypress="autogrow(this)">new widgets system</textarea>''' % {'eid': file.eid})
+<textarea cols="80" name="data:%(eid)s" onkeypress="autogrow(this)" rows="20" tabindex="3">new widgets system</textarea>''' % {'eid': file.eid})
 
 
     def test_passwordfield(self):
@@ -171,9 +171,9 @@
             upassword = StringField(widget=PasswordInput)
         form = PFForm(self.req, redirect_path='perdu.com', entity=self.entity)
         self.assertTextEquals(self._render_entity_field('upassword', form),
-                              '''<input id="upassword:%(eid)s" type="password" name="upassword:%(eid)s" value="__cubicweb_internal_field__" tabindex="0"/>
+                              '''<input id="upassword:%(eid)s" name="upassword:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"/>
 <br/>
-<input type="password" name="upassword-confirm:%(eid)s" value="__cubicweb_internal_field__" tabindex="0"/>
+<input name="upassword-confirm:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"/>
 &nbsp;
 <span class="emphasis">confirm password</span>''' % {'eid': self.entity.eid})
 
--- a/web/test/unittest_formfields.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_formfields.py	Mon May 04 15:49:36 2009 +0200
@@ -13,7 +13,7 @@
 schema = config.load_schema()
 state_schema = schema['State']
 cwuser_schema = schema['CWUser']
-file_schema.schema = schema['File']
+file_schema = schema['File']
 
 class GuessFieldTC(TestCase):
 
--- a/web/test/unittest_magicsearch.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_magicsearch.py	Mon May 04 15:49:36 2009 +0200
@@ -33,7 +33,7 @@
 
 class QueryTranslatorTC(EnvBasedTC):
     """test suite for QueryTranslatorTC"""
-    
+
     def setUp(self):
         super(QueryTranslatorTC, self).setUp()
         self.req = self.env.create_request()
@@ -83,7 +83,7 @@
         self.assertEquals(translate(u'prénom', eschema), "firstname")
         self.assertEquals(translate(u'nom', eschema), 'surname')
         #self.assert_(translate(u'nom') in ('name', 'surname'))
-        eschema = self.schema.eschema('EmailAddress')        
+        eschema = self.schema.eschema('EmailAddress')
         self.assertEquals(translate(u'adresse', eschema), "address")
         self.assertEquals(translate(u'nom', eschema), 'alias')
         # should fail if the name is not an attribute for the given entity schema
@@ -96,9 +96,9 @@
         self.assertEquals(transform('123'),
                           ('Any X WHERE X eid %(x)s', {'x': 123}, 'x'))
         self.assertEquals(transform('CWUser'),
-                          ('CWUser E',))
+                          ('CWUser C',))
         self.assertEquals(transform('Utilisateur'),
-                          ('CWUser E',))
+                          ('CWUser C',))
         self.assertEquals(transform('Adresse'),
                           ('EmailAddress E',))
         self.assertEquals(transform('adresse'),
@@ -111,9 +111,9 @@
         self.assertEquals(transform('CWUser', 'E'),
                           ("CWUser E",))
         self.assertEquals(transform('CWUser', 'Smith'),
-                          ('CWUser E WHERE E has_text %(text)s', {'text': 'Smith'}))
+                          ('CWUser C WHERE C has_text %(text)s', {'text': 'Smith'}))
         self.assertEquals(transform('utilisateur', 'Smith'),
-                          ('CWUser E WHERE E has_text %(text)s', {'text': 'Smith'}))
+                          ('CWUser C WHERE C has_text %(text)s', {'text': 'Smith'}))
         self.assertEquals(transform(u'adresse', 'Logilab'),
                           ('EmailAddress E WHERE E has_text %(text)s', {'text': 'Logilab'}))
         self.assertEquals(transform(u'adresse', 'Logi%'),
@@ -125,22 +125,22 @@
         """tests the 'three words shortcut queries'"""
         transform = self.proc._three_words_query
         self.assertEquals(transform('utilisateur', u'prénom', 'cubicweb'),
-                          ('CWUser E WHERE E firstname %(text)s', {'text': 'cubicweb'}))
+                          ('CWUser C WHERE C firstname %(text)s', {'text': 'cubicweb'}))
         self.assertEquals(transform('utilisateur', 'nom', 'cubicweb'),
-                          ('CWUser E WHERE E surname %(text)s', {'text': 'cubicweb'}))
+                          ('CWUser C WHERE C surname %(text)s', {'text': 'cubicweb'}))
         self.assertEquals(transform(u'adresse', 'nom', 'cubicweb'),
                           ('EmailAddress E WHERE E alias %(text)s', {'text': 'cubicweb'}))
         self.assertEquals(transform('EmailAddress', 'nom', 'cubicweb'),
-                          ('EmailAddress E WHERE E alias %(text)s', {'text': 'cubicweb'})) 
+                          ('EmailAddress E WHERE E alias %(text)s', {'text': 'cubicweb'}))
         self.assertEquals(transform('utilisateur', u'prénom', 'cubicweb%'),
-                          ('CWUser E WHERE E firstname LIKE %(text)s', {'text': 'cubicweb%'}))
+                          ('CWUser C WHERE C firstname LIKE %(text)s', {'text': 'cubicweb%'}))
         # expanded shortcuts
         self.assertEquals(transform('CWUser', 'use_email', 'Logilab'),
-                          ('CWUser E WHERE E use_email E1, E1 has_text %(text)s', {'text': 'Logilab'}))
+                          ('CWUser C WHERE C use_email C1, C1 has_text %(text)s', {'text': 'Logilab'}))
         self.assertEquals(transform('CWUser', 'use_email', '%Logilab'),
-                          ('CWUser E WHERE E use_email E1, E1 alias LIKE %(text)s', {'text': '%Logilab'}))
+                          ('CWUser C WHERE C use_email C1, C1 alias LIKE %(text)s', {'text': '%Logilab'}))
         self.assertRaises(BadRQLQuery, transform, 'word1', 'word2', 'word3')
-        
+
     def test_multiple_words_query(self):
         """tests multiple_words_query()"""
         self.assertEquals(self.proc._multiple_words_query(['a', 'b', 'c', 'd', 'e']),
@@ -150,9 +150,9 @@
         """tests how quoted queries are handled"""
         queries = [
             (u'Adresse "My own EmailAddress"', ('EmailAddress E WHERE E has_text %(text)s', {'text': u'My own EmailAddress'})),
-            (u'Utilisateur prénom "Jean Paul"', ('CWUser E WHERE E firstname %(text)s', {'text': 'Jean Paul'})),
-            (u'Utilisateur firstname "Jean Paul"', ('CWUser E WHERE E firstname %(text)s', {'text': 'Jean Paul'})),
-            (u'CWUser firstname "Jean Paul"', ('CWUser E WHERE E firstname %(text)s', {'text': 'Jean Paul'})),
+            (u'Utilisateur prénom "Jean Paul"', ('CWUser C WHERE C firstname %(text)s', {'text': 'Jean Paul'})),
+            (u'Utilisateur firstname "Jean Paul"', ('CWUser C WHERE C firstname %(text)s', {'text': 'Jean Paul'})),
+            (u'CWUser firstname "Jean Paul"', ('CWUser C WHERE C firstname %(text)s', {'text': 'Jean Paul'})),
             ]
         transform = self.proc._quoted_words_query
         for query, expected in queries:
@@ -160,23 +160,23 @@
         self.assertRaises(BadRQLQuery, transform, "unquoted rql")
         self.assertRaises(BadRQLQuery, transform, 'pers "Jean Paul"')
         self.assertRaises(BadRQLQuery, transform, 'CWUser firstname other "Jean Paul"')
-    
+
     def test_process_query(self):
         """tests how queries are processed"""
         queries = [
-            (u'Utilisateur', (u"CWUser E",)),
+            (u'Utilisateur', (u"CWUser C",)),
             (u'Utilisateur P', (u"CWUser P",)),
-            (u'Utilisateur cubicweb', (u'CWUser E WHERE E has_text %(text)s', {'text': u'cubicweb'})),
-            (u'CWUser prénom cubicweb', (u'CWUser E WHERE E firstname %(text)s', {'text': 'cubicweb'},)),
+            (u'Utilisateur cubicweb', (u'CWUser C WHERE C has_text %(text)s', {'text': u'cubicweb'})),
+            (u'CWUser prénom cubicweb', (u'CWUser C WHERE C firstname %(text)s', {'text': 'cubicweb'},)),
             (u'Any X WHERE X is Something', (u"Any X WHERE X is Something",)),
             ]
         for query, expected in queries:
             self.assertEquals(self.proc.preprocess_query(query, self.req), expected)
-        
+
 
 
 ## Processor Chains tests ############################################
-        
+
 
 class ProcessorChainTC(EnvBasedTC):
     """test suite for magic_search's processor chains"""
@@ -195,9 +195,9 @@
             # XXX this sounds like a language translator test...
             # and it fail
             (u'Utilisateur Smith',
-             ('CWUser E WHERE E has_text %(text)s', {'text': u'Smith'})),
+             ('CWUser C WHERE C has_text %(text)s', {'text': u'Smith'})),
             (u'utilisateur nom Smith',
-             ('CWUser E WHERE E surname %(text)s', {'text': u'Smith'})),
+             ('CWUser C WHERE C surname %(text)s', {'text': u'Smith'})),
             (u'Any P WHERE P is Utilisateur, P nom "Smith"',
              ('Any P WHERE P is CWUser, P surname "Smith"', None)),
             ]
@@ -219,6 +219,6 @@
         rset = self.proc.process_query(u'text: utilisateur Smith', self.req)
         self.assertEquals(rset.rql, 'Any X WHERE X has_text %(text)s')
         self.assertEquals(rset.args, {'text': u'utilisateur Smith'})
-                          
+
 if __name__ == '__main__':
     unittest_main()
--- a/web/test/unittest_urlpublisher.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_urlpublisher.py	Mon May 04 15:49:36 2009 +0200
@@ -21,11 +21,11 @@
         b = self.add_entity('BlogEntry', title=u'hell\'o', content=u'blabla')
         c = self.add_entity('Tag', name=u'yo') # take care: Tag's name normalized to lower case
         self.execute('SET C tags B WHERE C eid %(c)s, B eid %(b)s', {'c':c.eid, 'b':b.eid}, 'b')
-                          
+
     def process(self, url):
         req = self.req = self.request()
         return self.env.app.url_resolver.process(req, url)
-        
+
     def test_raw_path(self):
         """tests raw path resolution'"""
         self.assertEquals(self.process('view'), ('view', None))
@@ -51,12 +51,12 @@
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
         self.assertEquals(rset.printable_rql(), 'Any X WHERE X is CWUser, X login "admin"')
-        ctrl, rset = self.process('euser/admin')
+        ctrl, rset = self.process('cwuser/admin')
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
         self.assertEquals(rset.printable_rql(), 'Any X WHERE X is CWUser, X login "admin"')
-        ctrl, rset = self.process('euser/eid/%s'%rset[0][0])
+        ctrl, rset = self.process('cwuser/eid/%s'%rset[0][0])
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
@@ -77,7 +77,7 @@
         self.assertRaises(NotFound, self.process, 'CWUser/eid/30000')
         self.assertRaises(NotFound, self.process, 'Workcases')
         self.assertRaises(NotFound, self.process, 'CWUser/inexistant_attribute/joe')
-    
+
     def test_action_path(self):
         """tests the action path resolution"""
         self.assertRaises(Redirect, self.process, '1/edit')
@@ -92,7 +92,7 @@
         """tests the regexp path resolution"""
         ctrl, rset = self.process('add/Task')
         self.assertEquals(ctrl, 'view')
-        self.assertEquals(rset, None) 
+        self.assertEquals(rset, None)
         self.assertEquals(self.req.form, {'etype' : "Task", 'vid' : "creation"})
         self.assertRaises(NotFound, self.process, 'add/foo/bar')
 
@@ -103,11 +103,11 @@
         try:
             path = str(FakeRequest().url_quote(u'été'))
             ctrl, rset = self.process(path)
-            self.assertEquals(rset, None) 
+            self.assertEquals(rset, None)
             self.assertEquals(self.req.form, {'vid' : "foo"})
         finally:
             SimpleReqRewriter.rules = oldrules
-            
+
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/test/unittest_views_basecontrollers.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_views_basecontrollers.py	Mon May 04 15:49:36 2009 +0200
@@ -89,7 +89,7 @@
             }
         path, params = self.expect_redirect_publish(req)
         cnx.commit() # commit to check we don't get late validation error for instance
-        self.assertEquals(path, 'euser/user')
+        self.assertEquals(path, 'cwuser/user')
         self.failIf('vid' in params)
 
     def testr_user_editing_itself_no_relation(self):
@@ -137,7 +137,7 @@
                          }
         path, params = self.expect_redirect_publish()
         # should be redirected on the created person
-        self.assertEquals(path, 'euser/adim')
+        self.assertEquals(path, 'cwuser/adim')
         e = self.execute('Any P WHERE P surname "Di Mascio"').get_entity(0, 0)
         self.assertEquals(e.surname, 'Di Mascio')
         email = e.use_email[0]
@@ -329,7 +329,7 @@
         self.req.form = {'eid': str(eid), '__type:%s'%eid: 'EmailAddress',
                          '__action_delete': ''}
         path, params = self.expect_redirect_publish()
-        self.assertEquals(path, 'euser/admin')
+        self.assertEquals(path, 'cwuser/admin')
         self.assertEquals(params, {u'__message': u'entity deleted'})
         eid1 = self.add_entity('BlogEntry', title=u'hop', content=u'hop').eid
         eid2 = self.add_entity('EmailAddress', address=u'hop@logilab.fr').eid
@@ -448,7 +448,7 @@
                          'upassword:X': u'toto', 'upassword-confirm:X': u'toto', 'edits-upassword:X': u'',
                          }
         path, params = self.expect_redirect_publish()
-        self.assertEquals(path, 'euser/toto')
+        self.assertEquals(path, 'cwuser/toto')
         e = self.execute('Any X WHERE X is CWUser, X login "toto"').get_entity(0, 0)
         self.assertEquals(e.login, 'toto')
         self.assertEquals(e.in_group[0].name, 'managers')
@@ -527,16 +527,18 @@
 
     ## tests ##################################################################
     def test_simple_exec(self):
-        ctrl = self.ctrl(self.request(rql='CWUser P WHERE P login "John"',
-                                      pageid='123'))
+        req = self.request(rql='CWUser P WHERE P login "John"',
+                           pageid='123', fname='view')
+        ctrl = self.ctrl(req)
+        rset = self.john.as_rset()
         self.assertTextEquals(ctrl.publish(),
-                              xhtml_wrap(self.john.view('primary')))
+                              xhtml_wrap(ctrl.view('primary', rset)))
 
-    def test_json_exec(self):
-        rql = 'Any T,N WHERE T is Tag, T name N'
-        ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123'))
-        self.assertEquals(ctrl.publish(),
-                          simplejson.dumps(self.execute(rql).rows))
+#     def test_json_exec(self):
+#         rql = 'Any T,N WHERE T is Tag, T name N'
+#         ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123'))
+#         self.assertEquals(ctrl.publish(),
+#                           simplejson.dumps(self.execute(rql).rows))
 
     def test_remote_add_existing_tag(self):
         self.remote_call('tag_entity', self.john.eid, ['python'])
@@ -562,7 +564,7 @@
                          eid)
         self.commit()
         rset = self.execute('CWUser P')
-        # make sure we did not insert a new euser here
+        # make sure we did not insert a new cwuser here
         self.assertEquals(len(rset), nbusers)
         john = self.execute('Any X WHERE X eid %(x)s', {'x': self.john.eid}, 'x').get_entity(0, 0)
         self.assertEquals(john.eid, self.john.eid)
@@ -570,12 +572,12 @@
 
 
     def test_pending_insertion(self):
-        res, req = self.remote_call('add_pending_insert', ['12', 'tags', '13'])
+        res, req = self.remote_call('add_pending_inserts', [['12', 'tags', '13']])
         deletes = req.get_pending_deletes()
         self.assertEquals(deletes, [])
         inserts = req.get_pending_inserts()
         self.assertEquals(inserts, ['12:tags:13'])
-        res, req = self.remote_call('add_pending_insert', ['12', 'tags', '14'])
+        res, req = self.remote_call('add_pending_inserts', [['12', 'tags', '14']])
         deletes = req.get_pending_deletes()
         self.assertEquals(deletes, [])
         inserts = req.get_pending_inserts()
@@ -609,7 +611,7 @@
 
     def test_remove_pending_operations(self):
         self.remote_call('add_pending_delete', ['12', 'tags', '13'])
-        _, req = self.remote_call('add_pending_insert', ['12', 'tags', '14'])
+        _, req = self.remote_call('add_pending_inserts', [['12', 'tags', '14']])
         inserts = req.get_pending_inserts()
         self.assertEquals(inserts, ['12:tags:14'])
         deletes = req.get_pending_deletes()
@@ -636,7 +638,7 @@
                           simplejson.dumps(['bimboom']))
 
     def test_format_date(self):
-        self.assertEquals(self.remote_call('format_date', '"2007-01-01 12:00:00"')[0],
+        self.assertEquals(self.remote_call('format_date', '2007-01-01 12:00:00')[0],
                           simplejson.dumps('2007/01/01'))
 
 
--- a/web/test/unittest_views_baseviews.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_views_baseviews.py	Mon May 04 15:49:36 2009 +0200
@@ -6,17 +6,17 @@
 from cubicweb.devtools.apptest import EnvBasedTC
 
 from cubicweb.web.htmlwidgets import TableWidget
-from cubicweb.web.views.baseviews import vid_from_rset
+from cubicweb.web.views import vid_from_rset
 
 def loadjson(value):
     return loads(html_unescape(value))
 
 class VidFromRsetTC(EnvBasedTC):
-    
+
     def test_no_rset(self):
         req = self.request()
         self.assertEquals(vid_from_rset(req, None, self.schema), 'index')
-    
+
     def test_no_entity(self):
         req = self.request()
         rset = self.execute('Any X WHERE X login "blabla"')
@@ -36,24 +36,24 @@
         req = self.request()
         rset = self.execute('Any X WHERE X eid 1')
         self.assertEquals(vid_from_rset(req, rset, self.schema), 'primary')
-        
+
     def test_more_than_one_entity(self):
         req = self.request()
         rset = self.execute('Any X WHERE X is CWUser')
         self.assertEquals(vid_from_rset(req, rset, self.schema), 'list')
         rset = self.execute('Any X, L WHERE X login L')
         self.assertEquals(vid_from_rset(req, rset, self.schema), 'list')
-    
+
     def test_more_than_one_entity_by_row(self):
         req = self.request()
         rset = self.execute('Any X, G WHERE X in_group G')
         self.assertEquals(vid_from_rset(req, rset, self.schema), 'table')
-    
+
     def test_more_than_one_entity_by_row_2(self):
         req = self.request()
         rset = self.execute('Any X, GN WHERE X in_group G, G name GN')
         self.assertEquals(vid_from_rset(req, rset, self.schema), 'table')
-    
+
     def test_aggregat(self):
         req = self.request()
         rset = self.execute('Any X, COUNT(T) GROUPBY X WHERE X is T')
@@ -81,7 +81,7 @@
         req = self.request()
         view = self.vreg.select_view('table', req, rset)
         return e, rset, view
-      
+
     def test_headers(self):
         self.skip('implement me')
 
--- a/web/test/unittest_views_editforms.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_views_editforms.py	Mon May 04 15:49:36 2009 +0200
@@ -1,7 +1,7 @@
 from logilab.common.testlib import unittest_main
 from cubicweb.devtools.apptest import EnvBasedTC
 from cubicweb.devtools.testlib import WebTest
-from cubicweb.web.views.editforms import AutomaticEntityForm as AEF
+from cubicweb.web.views.autoform import AutomaticEntityForm as AEF
 from cubicweb.web.formwidgets import AutoCompletionWidget
 def rbc(entity, category):
     return [(rschema.type, x) for rschema, tschemas, x in AEF.erelations_by_category(entity, category)]
@@ -15,7 +15,7 @@
                                        entity=self.user())
         field = form.field_by_name('login')
         self.assertIsInstance(field.widget, AutoCompletionWidget)
-        AEF.rwidgets.del_rtag('login', 'subject', 'CWUser')
+        AEF.rwidgets.del_rtag(('CWUser', 'login', '*'),'subject')
 
 
     def test_euser_relations_by_category(self):
@@ -44,14 +44,14 @@
                                ('bookmarked_by', 'object'),
                                ])
         self.assertListEquals(rbc(e, 'generic'),
-                              [('primary_email', 'subject'),
-                               ('use_email', 'subject'),
-                               ('connait', 'subject'),
+                              [('connait', 'subject'),
                                ('checked_by', 'object'),
                                ])
         # owned_by is defined both as subject and object relations on CWUser
         self.assertListEquals(rbc(e, 'generated'),
-                              [('has_text', 'subject'),
+                              [('primary_email', 'subject'),
+                               ('use_email', 'subject'),
+                               ('has_text', 'subject'),
                                ('identity', 'subject'),
                                ('is', 'subject'),
                                ('is_instance_of', 'subject'),
--- a/web/test/unittest_viewselector.py	Mon May 04 15:49:20 2009 +0200
+++ b/web/test/unittest_viewselector.py	Mon May 04 15:49:36 2009 +0200
@@ -12,17 +12,18 @@
                                 traced_selection)
 from cubicweb.web import NoSelectableObject
 from cubicweb.web.action import Action
-from cubicweb.web.views import (baseviews, tableview, baseforms, calendar,
-                                management, embedding, actions, startup,
-                                euser, schemaentities, xbel, vcard, owl,
-                                treeview, idownloadable, wdoc, debug, eproperties)
+from cubicweb.web.views import (primary, baseviews, tableview, editforms,
+                                calendar, management, embedding, actions,
+                                startup, cwuser, schema, xbel, vcard, owl,
+                                treeview, idownloadable, wdoc, debug,
+                                cwproperties, workflow, xmlrss, csvexport)
 
 USERACTIONS = [('myprefs', actions.UserPreferencesAction),
                ('myinfos', actions.UserInfoAction),
                ('logout', actions.LogoutAction)]
 SITEACTIONS = [('siteconfig', actions.SiteConfigurationAction),
                ('manage', actions.ManageAction),
-               ('schema', actions.ViewSchemaAction)]
+               ('schema', schema.ViewSchemaAction)]
 
 
 class ViewSelectorTC(EnvBasedTC):
@@ -65,13 +66,13 @@
         self.assertListEqual(self.pviews(req, None),
                              [('changelog', wdoc.ChangeLogView),
                               ('debug', debug.DebugView),
-                              ('epropertiesform', eproperties.EPropertiesForm),
+                              ('epropertiesform', cwproperties.EPropertiesForm),
                               ('index', startup.IndexView),
                               ('info', management.ProcessInformationView),
                               ('manage', startup.ManageView),
                               ('owl', owl.OWLView),
                               ('schema', startup.SchemaView),
-                              ('systemepropertiesform', eproperties.SystemEPropertiesForm)])
+                              ('systemepropertiesform', cwproperties.SystemEPropertiesForm)])
 
     def test_possible_views_noresult(self):
         rset, req = self.env.get_rset_and_req('Any X WHERE X eid 999999')
@@ -81,92 +82,92 @@
     def test_possible_views_one_egroup(self):
         rset, req = self.env.get_rset_and_req('CWGroup X WHERE X name "managers"')
         self.assertListEqual(self.pviews(req, rset),
-                             [('csvexport', baseviews.CSVRsetView),
-                              ('ecsvexport', baseviews.CSVEntityView),
+                             [('csvexport', csvexport.CSVRsetView),
+                              ('ecsvexport', csvexport.CSVEntityView),
                               ('editable-table', tableview.EditableTableView),
                               ('filetree', treeview.FileTreeView),
                               ('list', baseviews.ListView),
                               ('oneline', baseviews.OneLineView),
                               ('owlabox', owl.OWLABOXView),
-                              ('primary', baseviews.PrimaryView),
-                              ('rsetxml', baseviews.XMLRsetView),
-                              ('rss', baseviews.RssView),
+                              ('primary', primary.PrimaryView),
+                              ('rsetxml', xmlrss.XMLRsetView),
+                              ('rss', xmlrss.RSSView),
                               ('secondary', baseviews.SecondaryView),
                               ('security', management.SecurityManagementView),
                               ('table', tableview.TableView),
                               ('text', baseviews.TextView),
                               ('treeview', treeview.TreeView),
                               ('xbel', xbel.XbelView),
-                              ('xml', baseviews.XmlView),
+                              ('xml', xmlrss.XMLView),
                               ])
 
     def test_possible_views_multiple_egroups(self):
         rset, req = self.env.get_rset_and_req('CWGroup X')
         self.assertListEqual(self.pviews(req, rset),
-                             [('csvexport', baseviews.CSVRsetView),
-                              ('ecsvexport', baseviews.CSVEntityView),
+                             [('csvexport', csvexport.CSVRsetView),
+                              ('ecsvexport', csvexport.CSVEntityView),
                               ('editable-table', tableview.EditableTableView),
                               ('filetree', treeview.FileTreeView),
                               ('list', baseviews.ListView),
                               ('oneline', baseviews.OneLineView),
                               ('owlabox', owl.OWLABOXView),
-                              ('primary', baseviews.PrimaryView),
-                              ('rsetxml', baseviews.XMLRsetView),
-                              ('rss', baseviews.RssView),
+                              ('primary', primary.PrimaryView),
+                              ('rsetxml', xmlrss.XMLRsetView),
+                              ('rss', xmlrss.RSSView),
                               ('secondary', baseviews.SecondaryView),
                               ('security', management.SecurityManagementView),
                               ('table', tableview.TableView),
                               ('text', baseviews.TextView),
                               ('treeview', treeview.TreeView),
                               ('xbel', xbel.XbelView),
-                              ('xml', baseviews.XmlView),
+                              ('xml', xmlrss.XMLView),
                               ])
 
     def test_possible_views_multiple_different_types(self):
         rset, req = self.env.get_rset_and_req('Any X')
         self.assertListEqual(self.pviews(req, rset),
-                             [('csvexport', baseviews.CSVRsetView),
-                              ('ecsvexport', baseviews.CSVEntityView),
+                             [('csvexport', csvexport.CSVRsetView),
+                              ('ecsvexport', csvexport.CSVEntityView),
                               ('editable-table', tableview.EditableTableView),
                               ('filetree', treeview.FileTreeView),
                               ('list', baseviews.ListView),
                               ('oneline', baseviews.OneLineView),
                               ('owlabox', owl.OWLABOXView),
-                              ('primary', baseviews.PrimaryView),
-                              ('rsetxml', baseviews.XMLRsetView),
-                              ('rss', baseviews.RssView),
+                              ('primary', primary.PrimaryView),
+                              ('rsetxml', xmlrss.XMLRsetView),
+                              ('rss', xmlrss.RSSView),
                               ('secondary', baseviews.SecondaryView),
                               ('security', management.SecurityManagementView),
                               ('table', tableview.TableView),
                               ('text', baseviews.TextView),
                               ('treeview', treeview.TreeView),
                               ('xbel', xbel.XbelView),
-                              ('xml', baseviews.XmlView),
+                              ('xml', xmlrss.XMLView),
                               ])
 
     def test_possible_views_any_rset(self):
         rset, req = self.env.get_rset_and_req('Any N, X WHERE X in_group Y, Y name N')
         self.assertListEqual(self.pviews(req, rset),
-                             [('csvexport', baseviews.CSVRsetView),
+                             [('csvexport', csvexport.CSVRsetView),
                               ('editable-table', tableview.EditableTableView),
-                              ('rsetxml', baseviews.XMLRsetView),
+                              ('rsetxml', xmlrss.XMLRsetView),
                               ('table', tableview.TableView),
                               ])
 
     def test_possible_views_multiple_eusers(self):
         rset, req = self.env.get_rset_and_req('CWUser X')
         self.assertListEqual(self.pviews(req, rset),
-                             [('csvexport', baseviews.CSVRsetView),
-                              ('ecsvexport', baseviews.CSVEntityView),
+                             [('csvexport', csvexport.CSVRsetView),
+                              ('ecsvexport', csvexport.CSVEntityView),
                               ('editable-table', tableview.EditableTableView),
                               ('filetree', treeview.FileTreeView),
-                              ('foaf', euser.FoafView),
+                              ('foaf', cwuser.FoafView),
                               ('list', baseviews.ListView),
                               ('oneline', baseviews.OneLineView),
                               ('owlabox', owl.OWLABOXView),
-                              ('primary', euser.CWUserPrimaryView),
-                              ('rsetxml', baseviews.XMLRsetView),
-                              ('rss', baseviews.RssView),
+                              ('primary', cwuser.CWUserPrimaryView),
+                              ('rsetxml', xmlrss.XMLRsetView),
+                              ('rss', xmlrss.RSSView),
                               ('secondary', baseviews.SecondaryView),
                               ('security', management.SecurityManagementView),
                               ('table', tableview.TableView),
@@ -174,7 +175,7 @@
                               ('treeview', treeview.TreeView),
                               ('vcard', vcard.VCardCWUserView),
                               ('xbel', xbel.XbelView),
-                              ('xml', baseviews.XmlView),
+                              ('xml', xmlrss.XMLView),
                               ])
 
     def test_possible_actions_none_rset(self):
@@ -215,16 +216,17 @@
                              {'useractions': USERACTIONS,
                               'siteactions': SITEACTIONS})
 
-    def test_possible_actions_eetype_euser_entity(self):
+    def test_possible_actions_eetype_cwuser_entity(self):
         rset, req = self.env.get_rset_and_req('CWEType X WHERE X name "CWUser"')
         self.assertDictEqual(self.pactions(req, rset),
                              {'useractions': USERACTIONS,
                               'siteactions': SITEACTIONS,
                               'mainactions': [('edit', actions.ModifyAction),
-                                              ('workflow', schemaentities.ViewWorkflowAction),],
-                              'moreactions': [('delete', actions.DeleteAction),
+                                              ('workflow', workflow.ViewWorkflowAction),],
+                              'moreactions': [('managepermission', actions.ManagePermissionsAction),
+                                              ('delete', actions.DeleteAction),
                                               ('copy', actions.CopyAction),
-                                              ('managepermission', actions.ManagePermissionsAction)],
+                                              ],
                               })
 
 
@@ -234,11 +236,12 @@
         # creation form
         req.form['etype'] = 'CWGroup'
         self.assertIsInstance(self.vreg.select_view('creation', req, rset),
-                                  baseforms.CreationForm)
+                              editforms.CreationFormView)
         del req.form['etype']
         # custom creation form
-        class CWUserCreationForm(baseforms.CreationForm):
+        class CWUserCreationForm(editforms.CreationFormView):
             __select__ = specified_etype_implements('CWUser')
+        self.vreg._loadedmods[__name__] = {}
         self.vreg.register_vobject_class(CWUserCreationForm)
         req.form['etype'] = 'CWUser'
         self.assertIsInstance(self.vreg.select_view('creation', req, rset),
@@ -268,11 +271,11 @@
         # one entity
         rset, req = self.env.get_rset_and_req('CWGroup X WHERE X name "managers"')
         self.assertIsInstance(self.vreg.select_view('primary', req, rset),
-                             baseviews.PrimaryView)
+                             primary.PrimaryView)
         self.assertIsInstance(self.vreg.select_view('list', req, rset),
                              baseviews.ListView)
         self.assertIsInstance(self.vreg.select_view('edition', req, rset),
-                             baseforms.EditionForm)
+                             editforms.EditionFormView)
         self.assertIsInstance(self.vreg.select_view('table', req, rset),
                              tableview.TableView)
         self.failUnlessRaises(NoSelectableObject,
@@ -282,7 +285,7 @@
         # list of entities of the same type
         rset, req = self.env.get_rset_and_req('CWGroup X')
         self.assertIsInstance(self.vreg.select_view('primary', req, rset),
-                             baseviews.PrimaryView)
+                             primary.PrimaryView)
         self.assertIsInstance(self.vreg.select_view('list', req, rset),
                              baseviews.ListView)
         self.assertIsInstance(self.vreg.select_view('table', req, rset),
@@ -292,7 +295,7 @@
         # list of entities of different types
         rset, req = self.env.get_rset_and_req('Any X')
         self.assertIsInstance(self.vreg.select_view('primary', req, rset),
-                                  baseviews.PrimaryView)
+                                  primary.PrimaryView)
         self.assertIsInstance(self.vreg.select_view('list', req, rset),
                                   baseviews.ListView)
         self.assertIsInstance(self.vreg.select_view('table', req, rset),
@@ -323,10 +326,10 @@
                               self.vreg.select_view, 'creation', req, rset)
         self.assertIsInstance(self.vreg.select_view('table', req, rset),
                               tableview.TableView)
-        # euser primary view priority
+        # 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),
-                             euser.CWUserPrimaryView)
+                             cwuser.CWUserPrimaryView)
         self.assertIsInstance(self.vreg.select_view('text', req, rset),
                              baseviews.TextView)
 
@@ -401,6 +404,7 @@
 
     def setUp(self):
         super(RQLActionTC, self).setUp()
+        self.vreg._loadedmods[__name__] = {}
         self.vreg.register_vobject_class(CWETypeRQLAction)
 
     def tearDown(self):
@@ -413,19 +417,21 @@
                              {'useractions': USERACTIONS,
                               'siteactions': SITEACTIONS,
                               'mainactions': [('edit', actions.ModifyAction)],
-                              'moreactions': [('delete', actions.DeleteAction),
+                              'moreactions': [('managepermission', actions.ManagePermissionsAction),
+                                              ('delete', actions.DeleteAction),
                                               ('copy', actions.CopyAction),
                                               ('testaction', CWETypeRQLAction),
-                                              ('managepermission', actions.ManagePermissionsAction)],
+                                              ],
                               })
         rset, req = self.env.get_rset_and_req('CWEType X WHERE X name "CWRType"')
         self.assertDictEqual(self.pactions(req, rset),
                              {'useractions': USERACTIONS,
                               'siteactions': SITEACTIONS,
                               'mainactions': [('edit', actions.ModifyAction)],
-                              'moreactions': [('delete', actions.DeleteAction),
+                              'moreactions': [('managepermission', actions.ManagePermissionsAction),
+                                              ('delete', actions.DeleteAction),
                                               ('copy', actions.CopyAction),
-                                              ('managepermission', actions.ManagePermissionsAction)],
+                                              ],
                               })