330 try: |
330 try: |
331 form = self.app.handle_request(req, 'login') |
331 form = self.app.handle_request(req, 'login') |
332 except Redirect as redir: |
332 except Redirect as redir: |
333 self.fail('anonymous user should get login form') |
333 self.fail('anonymous user should get login form') |
334 clear_cache(req, 'get_authorization') |
334 clear_cache(req, 'get_authorization') |
335 self.assertTrue('__login' in form) |
335 self.assertIn('__login', form) |
336 self.assertTrue('__password' in form) |
336 self.assertIn('__password', form) |
337 self.assertFalse(req.cnx) # Mock cnx are False |
337 self.assertFalse(req.cnx) # Mock cnx are False |
338 req.form['__login'] = self.admlogin |
338 req.form['__login'] = self.admlogin |
339 req.form['__password'] = self.admpassword |
339 req.form['__password'] = self.admpassword |
340 self.assertAuthSuccess(req, origsession) |
340 self.assertAuthSuccess(req, origsession) |
341 self.assertRaises(LogOut, self.app_handle_request, req, 'logout') |
341 self.assertRaises(LogOut, self.app_handle_request, req, 'logout') |