fix tests stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 16 Mar 2010 17:44:32 +0100
branchstable
changeset 4916 4b8cdda342ae
parent 4911 898c35be5873
child 4917 756ded5bc9eb
child 4926 626d31035662
fix tests
devtools/testlib.py
web/test/unittest_views_pyviews.py
web/test/unittest_viewselector.py
web/views/authentication.py
web/views/debug.py
--- a/devtools/testlib.py	Tue Mar 16 12:40:59 2010 +0100
+++ b/devtools/testlib.py	Tue Mar 16 17:44:32 2010 +0100
@@ -503,7 +503,7 @@
         req.cnx = None
         sh = self.app.session_handler
         authm = sh.session_manager.authmanager
-        authm.authinforetreivers[-1].anoninfo = self.vreg.config.anonymous_user()
+        authm.anoninfo = self.vreg.config.anonymous_user()
         # not properly cleaned between tests
         self.open_sessions = sh.session_manager._sessions = {}
         return req, origcnx
--- a/web/test/unittest_views_pyviews.py	Tue Mar 16 12:40:59 2010 +0100
+++ b/web/test/unittest_views_pyviews.py	Tue Mar 16 17:44:32 2010 +0100
@@ -9,10 +9,10 @@
         content = view.render(pyvalue=[[1, 'a'], [2, 'b']],
                               headers=['num', 'char'])
         self.assertEquals(content.strip(), '''<table class="listing">
-<tr><th>num</th><th>char</th></tr>
-<tr><td>1</td><td>a</td></tr>
+<thead><tr><th>num</th><th>char</th></tr>
+</thead><tbody><tr><td>1</td><td>a</td></tr>
 <tr><td>2</td><td>b</td></tr>
-</table>''')
+</tbody></table>''')
 
     def test_pyvallist(self):
         view = self.vreg['views'].select('pyvallist', self.request(),
--- a/web/test/unittest_viewselector.py	Tue Mar 16 12:40:59 2010 +0100
+++ b/web/test/unittest_viewselector.py	Tue Mar 16 17:44:32 2010 +0100
@@ -67,6 +67,7 @@
         req = self.request()
         self.assertListEqual(self.pviews(req, None),
                              [('changelog', wdoc.ChangeLogView),
+                              ('gc', debug.GCView),
                               ('index', startup.IndexView),
                               ('info', debug.ProcessInformationView),
                               ('manage', startup.ManageView),
--- a/web/views/authentication.py	Tue Mar 16 12:40:59 2010 +0100
+++ b/web/views/authentication.py	Tue Mar 16 17:44:32 2010 +0100
@@ -140,13 +140,13 @@
         # restore an anonymous connection if possible
         login, password = self.anoninfo
         if login:
-            return self._authenticate(req, login, {'password': password})
+            cnx = self._authenticate(req, login, {'password': password})
+            cnx.anonymous_connection = True
+            return cnx
         raise ExplicitLogin()
 
     def _init_cnx(self, cnx, login, authinfo):
         # decorate connection
-        if login == self.vreg.config.anonymous_user()[0]:
-            cnx.anonymous_connection = True
         cnx.vreg = self.vreg
         cnx.login = login
         cnx.authinfo = authinfo
--- a/web/views/debug.py	Tue Mar 16 12:40:59 2010 +0100
+++ b/web/views/debug.py	Tue Mar 16 17:44:32 2010 +0100
@@ -119,7 +119,7 @@
     def call(self, **kwargs):
         self.w(u'<h1>%s</h1>' % _("Registry's content"))
         keys = sorted(self._cw.vreg)
-        url = self._cw.url()
+        url = xml_escape(self._cw.url())
         self.w(u'<p>%s</p>\n' % ' - '.join('<a href="%s#%s">%s</a>'
                                            % (url, key, key) for key in keys))
         for key in keys: