web/test/unittest_views_basecontrollers.py
branchstable
changeset 8487 017af22e7678
parent 8444 7a861620f64f
child 8504 f21c72928662
equal deleted inserted replaced
8486:399e916a97f3 8487:017af22e7678
   841 
   841 
   842 class LoginControllerTC(CubicWebTC):
   842 class LoginControllerTC(CubicWebTC):
   843 
   843 
   844     def test_login_with_dest(self):
   844     def test_login_with_dest(self):
   845         req = self.request()
   845         req = self.request()
   846         req.form = {'postlogin_path': '/elephants/babar'}
   846         req.form = {'postlogin_path': 'elephants/babar'}
   847         with self.assertRaises(Redirect) as cm:
   847         with self.assertRaises(Redirect) as cm:
   848             self.ctrl_publish(req, ctrl='login')
   848             self.ctrl_publish(req, ctrl='login')
   849         self.assertEqual('/elephants/babar', cm.exception.location)
   849         self.assertEqual(req.build_url('elephants/babar'), cm.exception.location)
   850 
   850 
   851     def test_login_no_dest(self):
   851     def test_login_no_dest(self):
   852         req = self.request()
   852         req = self.request()
   853         with self.assertRaises(Redirect) as cm:
   853         with self.assertRaises(Redirect) as cm:
   854             self.ctrl_publish(req, ctrl='login')
   854             self.ctrl_publish(req, ctrl='login')
   855         self.assertEqual('.', cm.exception.location)
   855         self.assertEqual(req.base_url(), cm.exception.location)
   856 
   856 
   857 if __name__ == '__main__':
   857 if __name__ == '__main__':
   858     unittest_main()
   858     unittest_main()