[web test] fix tests broken by 8de41063d629 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 23 Jul 2012 12:45:43 +0200
branchstable
changeset 8487 017af22e7678
parent 8486 399e916a97f3
child 8488 2afc157ea9b2
[web test] fix tests broken by 8de41063d629
web/test/unittest_views_basecontrollers.py
web/views/basecontrollers.py
--- a/web/test/unittest_views_basecontrollers.py	Fri Jul 20 15:17:32 2012 +0200
+++ b/web/test/unittest_views_basecontrollers.py	Mon Jul 23 12:45:43 2012 +0200
@@ -843,16 +843,16 @@
 
     def test_login_with_dest(self):
         req = self.request()
-        req.form = {'postlogin_path': '/elephants/babar'}
+        req.form = {'postlogin_path': 'elephants/babar'}
         with self.assertRaises(Redirect) as cm:
             self.ctrl_publish(req, ctrl='login')
-        self.assertEqual('/elephants/babar', cm.exception.location)
+        self.assertEqual(req.build_url('elephants/babar'), cm.exception.location)
 
     def test_login_no_dest(self):
         req = self.request()
         with self.assertRaises(Redirect) as cm:
             self.ctrl_publish(req, ctrl='login')
-        self.assertEqual('.', cm.exception.location)
+        self.assertEqual(req.base_url(), cm.exception.location)
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/views/basecontrollers.py	Fri Jul 20 15:17:32 2012 +0200
+++ b/web/views/basecontrollers.py	Mon Jul 23 12:45:43 2012 +0200
@@ -90,7 +90,7 @@
 
     def publish(self, rset=None):
         """log in the instance"""
-        path = self._cw.form.get('postlogin_path', '.')
+        path = self._cw.form.get('postlogin_path', '')
         # redirect expect an url, not a path. Also path may contains a query
         # string, hence should not be given to _cw.build_url()
         raise Redirect(self._cw.base_url() + path)