376 clear_cache(req, 'get_authorization') |
376 clear_cache(req, 'get_authorization') |
377 # reset session as if it was a new incoming request |
377 # reset session as if it was a new incoming request |
378 req.session = req.cnx = None |
378 req.session = req.cnx = None |
379 |
379 |
380 def _test_auth_anon(self, req): |
380 def _test_auth_anon(self, req): |
381 self.app.connect(req) |
381 asession = self.app.get_session(req) |
382 asession = req.session |
382 req.set_session(asession) |
383 self.assertEqual(len(self.open_sessions), 1) |
383 self.assertEqual(len(self.open_sessions), 1) |
384 self.assertEqual(asession.login, 'anon') |
384 self.assertEqual(asession.login, 'anon') |
385 self.assertTrue(asession.anonymous_session) |
385 self.assertTrue(asession.anonymous_session) |
386 self._reset_cookie(req) |
386 self._reset_cookie(req) |
387 |
387 |
388 def _test_anon_auth_fail(self, req): |
388 def _test_anon_auth_fail(self, req): |
389 self.assertEqual(len(self.open_sessions), 1) |
389 self.assertEqual(len(self.open_sessions), 1) |
390 self.app.connect(req) |
390 session = self.app.get_session(req) |
|
391 req.set_session(session) |
391 self.assertEqual(req.message, 'authentication failure') |
392 self.assertEqual(req.message, 'authentication failure') |
392 self.assertEqual(req.session.anonymous_session, True) |
393 self.assertEqual(req.session.anonymous_session, True) |
393 self.assertEqual(len(self.open_sessions), 1) |
394 self.assertEqual(len(self.open_sessions), 1) |
394 self._reset_cookie(req) |
395 self._reset_cookie(req) |
395 |
396 |