--- acct_mgr/tests/api.py +++ acct_mgr/tests/api.py @@ -50,6 +50,7 @@ class AccountManagerTestCase(_BaseTestCa incookie = Cookie() incookie['trac_session'] = '123456' self.req = Mock(authname='', args=args, authenticated=True, + is_authenticated=True, base_path='/', callbacks=dict(), chrome={'warnings': [], 'notices': []}, href=Mock(prefs=lambda x: None), --- acct_mgr/tests/guard.py +++ acct_mgr/tests/guard.py @@ -43,6 +43,7 @@ class AccountGuardTestCase(unittest.Test incookie = Cookie() incookie['trac_session'] = '123456' req = Mock(authname=bool(authenticated) and user or 'anonymous', + is_authenticated=bool(authenticated) and user, args=args, base_path='/', chrome=dict(warnings=list()), href=Mock(prefs=lambda x: None), --- acct_mgr/tests/model.py +++ acct_mgr/tests/model.py @@ -42,6 +42,7 @@ class ModelTestCase(unittest.TestCase): incookie = Cookie() incookie['trac_session'] = '123456' self.req = Mock(authname=bool(authenticated) and user or 'anonymous', + is_authenticated=bool(authenticated) and user, args=args, base_path='/', chrome=dict(warnings=list()), href=Mock(prefs=lambda x: None), --- acct_mgr/tests/register.py +++ acct_mgr/tests/register.py @@ -40,7 +40,7 @@ class _BaseTestCase(unittest.TestCase): self.perm.grant_permission('admin', 'ACCTMGR_USER_ADMIN') # Prepare a generic registration request. args = dict(username='', name='', email='') - self.req = Mock(authname='anonymous', args=args) + self.req = Mock(authname='anonymous', is_authenticated=False, args=args) self.req.path_info = '/register' self.req.perm = PermissionCache(self.env) @@ -123,7 +123,7 @@ class BotTrapCheckTestCase(_BaseTestCase req.args['basic_token'] = '' self.assertRaises(RegistrationError, check.validate_registration, req) # 3rd attempt: As before, but request done by authenticated user. - req = Mock(authname='admin', args=self.req.args) + req = Mock(authname='admin', is_authenticated=True, args=self.req.args) self.assertEqual(check.validate_registration(req), None) # 4th attempt: Finally valid input. req = self.req @@ -251,7 +251,7 @@ class UsernamePermCheckTestCase(_BaseTes req.args['username'] = 'admin' self.assertRaises(RegistrationError, check.validate_registration, req) # 4th attempt: As before, but request done by authenticated user. - req = Mock(authname='admin', args=self.req.args) + req = Mock(authname='admin', is_authenticated=True, args=self.req.args) self.assertEqual(check.validate_registration(req), None) @@ -305,6 +305,7 @@ class RegistrationModuleTestCase(_BaseTe 'password': passwd, 'password_confirm': passwd }, + is_authenticated=False, chrome=dict(notices=[], warnings=[]), href=self.env.abs_href, path_info='/register', perm=MockPerm(), redirect=lambda x: None @@ -332,6 +333,7 @@ class RegistrationModuleTestCase(_BaseTe 'password': passwd, 'password_confirm': passwd }, + is_authenticated=False, chrome=dict(notices=[], warnings=[]), href=self.env.abs_href, path_info='/register', perm=MockPerm(), redirect=redirect_noop @@ -360,6 +362,7 @@ class EmailVerificationModuleTestCase(_B incookie = Cookie() incookie['trac_session'] = '123456' self.req = Mock(authname='username', args=args, base_path='/', + is_authenticated=True, chrome=dict(warnings=list()), href=Mock(prefs=lambda x: None), get_header=lambda k: None,