[Zope-CVS] CVS: Products/PluggableAuthService/plugins/tests -
test_HTTPBasicAuthHelper.py:1.11
Lennart Regebro
regebro at nuxeo.com
Fri Sep 24 12:41:18 EDT 2004
Update of /cvs-repository/Products/PluggableAuthService/plugins/tests
In directory cvs.zope.org:/tmp/cvs-serv7170/plugins/tests
Modified Files:
test_HTTPBasicAuthHelper.py
Log Message:
Yet another attempt of ChallengeImplementation, that should cover all know usecases.
=== Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py 1.10 => 1.11 ===
--- Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py:1.10 Wed Sep 22 06:51:48 2004
+++ Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py Fri Sep 24 12:40:48 2004
@@ -42,10 +42,25 @@
class FauxHTTPResponse:
_unauthorized_called = 0
-
+ realm = 'unit test'
+ debug_mode = 0
+ headers = {}
+
def unauthorized( self ):
self._unauthorized_called = 1
+
+ def setStatus(self, status, reason=None):
+
+ self.status = status
+
+ def setHeader(self, name, value, literal=0):
+
+ self.headers[name] = value
+
+ def setBody(self, body, is_error=0):
+ self.body = body
+
class HTTPBasicAuthHelperTests( unittest.TestCase
, ILoginPasswordHostExtractionPlugin_conformance
@@ -88,7 +103,11 @@
response = FauxHTTPResponse()
self.failIf( response._unauthorized_called )
- self.failUnlessRaises(Unauthorized, helper.challenge, (request, response ), {})
+ helper.challenge(request, response)
+ self.failUnless(response.status, 401)
+ self.failUnless(response.headers['WWW-Authenticate'],
+ 'basic realm="unit test"')
+
def test_resetCredentials( self ):
More information about the Zope-CVS
mailing list