web/test/unittest_views_basecontrollers.py
changeset 8311 76a44a0d7f4b
parent 8267 486386d9f836
child 8312 6c2119509fac
--- a/web/test/unittest_views_basecontrollers.py	Thu Mar 01 12:08:35 2012 +0100
+++ b/web/test/unittest_views_basecontrollers.py	Thu Mar 15 17:42:31 2012 +0100
@@ -776,9 +776,6 @@
         self.assertEqual(res, '12')
 
 
-
-
-
 class UndoControllerTC(CubicWebTC):
 
     def setup_database(self):
@@ -836,5 +833,20 @@
         self.assertURLPath(cm.exception.location, 'toto')
 
 
+class LoginControllerTC(CubicWebTC):
+
+    def test_login_with_dest(self):
+        req = self.request()
+        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)
+
+    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)
+
 if __name__ == '__main__':
     unittest_main()