# HG changeset patch # User Thomas Waldmann # Date 1203775908 -3600 # Node ID 55e47727656f5387e8529c103d847320cba13340 # Parent 42f0eb176c8ea3010c774c5f866f2f4e72efbe09 keep request.user for auth tests diff -r 42f0eb176c8e -r 55e47727656f MoinMoin/auth/_tests/test_auth.py --- a/MoinMoin/auth/_tests/test_auth.py Sun Feb 10 03:13:18 2008 +0100 +++ b/MoinMoin/auth/_tests/test_auth.py Sat Feb 23 15:11:48 2008 +0100 @@ -58,6 +58,10 @@ """ run a simple request, no auth, just check if it succeeds """ environ = self.setup_env() request = self.process_request(environ) + + # anon user? + assert not request.user.valid + # check if the request resulted in normal status, result headers and content assert request.status == '200 OK' has_ct = has_v = has_cc = False @@ -83,9 +87,7 @@ def testAnonSession(self): """ run some requests, no auth, check if anon sessions work """ - from MoinMoin.auth import moin_session, moin_anon_session - self.config = self.TestConfig(auth=[moin_session, moin_anon_session], - anonymous_cookie_lifetime=1) + self.config = self.TestConfig(anonymous_cookie_lifetime=1) cookie = '' trail_expected = [] for pagename in self.PAGES: @@ -130,13 +132,9 @@ def testHttpAuthSession(self): """ run some requests with http auth, check whether session works """ - from MoinMoin.auth import moin_session, moin_anon_session - from MoinMoin.auth.http import http + from MoinMoin.auth.http import HTTPAuth username = u'HttpAuthTestUser' - # XXX BROKEN: should work without moin_anon_session, without anonymous_cookie_lifetime: - self.config = self.TestConfig(auth=[http, moin_session, moin_anon_session], - user_autocreate=True, - anonymous_cookie_lifetime=1) + self.config = self.TestConfig(auth=[HTTPAuth()], user_autocreate=True) cookie = '' trail_expected = [] for pagename in self.PAGES: @@ -183,9 +181,9 @@ def testMoinLoginAuthSession(self): """ run some requests with moin_login auth, check whether session works """ - from MoinMoin.auth import moin_login, moin_session + from MoinMoin.auth import MoinLogin from MoinMoin.user import User - self.config = self.TestConfig(auth=[moin_login, moin_session]) + self.config = self.TestConfig(auth=[MoinLogin()]) username = u'MoinLoginAuthTestUser' password = u'secret' User(self.request, name=username, password=password).save() # create user diff -r 42f0eb176c8e -r 55e47727656f MoinMoin/request/__init__.py --- a/MoinMoin/request/__init__.py Sun Feb 10 03:13:18 2008 +0100 +++ b/MoinMoin/request/__init__.py Sat Feb 23 15:11:48 2008 +0100 @@ -1576,7 +1576,7 @@ self._finishers = [] try: - del self.user + #del self.user # keeping this is useful for testing del self.theme del self.dicts except: