equal
deleted
inserted
replaced
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """unit tests for cubicweb.web.application""" |
18 """unit tests for cubicweb.web.application""" |
19 |
|
20 from __future__ import with_statement |
|
21 |
19 |
22 import base64, Cookie |
20 import base64, Cookie |
23 import sys |
21 import sys |
24 from urllib import unquote |
22 from urllib import unquote |
25 |
23 |
332 def test_cookie_auth_no_anon(self): |
330 def test_cookie_auth_no_anon(self): |
333 req, origsession = self.init_authentication('cookie') |
331 req, origsession = self.init_authentication('cookie') |
334 self.assertAuthFailure(req) |
332 self.assertAuthFailure(req) |
335 try: |
333 try: |
336 form = self.app_handle_request(req, 'login') |
334 form = self.app_handle_request(req, 'login') |
337 except Redirect, redir: |
335 except Redirect as redir: |
338 self.fail('anonymous user should get login form') |
336 self.fail('anonymous user should get login form') |
339 self.assertTrue('__login' in form) |
337 self.assertTrue('__login' in form) |
340 self.assertTrue('__password' in form) |
338 self.assertTrue('__password' in form) |
341 self.assertEqual(req.cnx, None) |
339 self.assertEqual(req.cnx, None) |
342 req.form['__login'] = self.admlogin |
340 req.form['__login'] = self.admlogin |