624 |
624 |
625 def assertAuthSuccess(self, req, origsession, nbsessions=1): |
625 def assertAuthSuccess(self, req, origsession, nbsessions=1): |
626 sh = self.app.session_handler |
626 sh = self.app.session_handler |
627 path, params = self.expect_redirect(lambda x: self.app.connect(x), req) |
627 path, params = self.expect_redirect(lambda x: self.app.connect(x), req) |
628 session = req.session |
628 session = req.session |
629 self.assertEquals(len(self.open_sessions), nbsessions, self.open_sessions) |
629 self.assertEqual(len(self.open_sessions), nbsessions, self.open_sessions) |
630 self.assertEquals(session.login, origsession.login) |
630 self.assertEqual(session.login, origsession.login) |
631 self.assertEquals(session.anonymous_session, False) |
631 self.assertEqual(session.anonymous_session, False) |
632 self.assertEquals(path, 'view') |
632 self.assertEqual(path, 'view') |
633 self.assertEquals(params, {'__message': 'welcome %s !' % req.user.login}) |
633 self.assertEqual(params, {'__message': 'welcome %s !' % req.user.login}) |
634 |
634 |
635 def assertAuthFailure(self, req, nbsessions=0): |
635 def assertAuthFailure(self, req, nbsessions=0): |
636 self.app.connect(req) |
636 self.app.connect(req) |
637 self.assertIsInstance(req.session, DBAPISession) |
637 self.assertIsInstance(req.session, DBAPISession) |
638 self.assertEquals(req.session.cnx, None) |
638 self.assertEqual(req.session.cnx, None) |
639 self.assertEquals(req.cnx, None) |
639 self.assertEqual(req.cnx, None) |
640 self.assertEquals(len(self.open_sessions), nbsessions) |
640 self.assertEqual(len(self.open_sessions), nbsessions) |
641 clear_cache(req, 'get_authorization') |
641 clear_cache(req, 'get_authorization') |
642 |
642 |
643 # content validation ####################################################### |
643 # content validation ####################################################### |
644 |
644 |
645 # validators are used to validate (XML, DTD, whatever) view's content |
645 # validators are used to validate (XML, DTD, whatever) view's content |