[Zope-CVS] CVS: Products/PluggableAuthService/plugins/tests -
test_HTTPBasicAuthHelper.py:1.11.2.1
Zachery Bir
zbir at urbanape.com
Thu Oct 14 09:38:11 EDT 2004
Update of /cvs-repository/Products/PluggableAuthService/plugins/tests
In directory cvs.zope.org:/tmp/cvs-serv10287
Modified Files:
Tag: pre-1_0_3-zbir-challenge-branch
test_HTTPBasicAuthHelper.py
Log Message:
needed to satisfy new HTTPBasicAuthHelper implementation
=== Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py 1.11 => 1.11.2.1 ===
--- Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py:1.11 Fri Sep 24 12:40:48 2004
+++ Products/PluggableAuthService/plugins/tests/test_HTTPBasicAuthHelper.py Thu Oct 14 09:38:11 2004
@@ -35,7 +35,7 @@
return None
return self._name, self._password
-
+
def get(self, name, default=None):
return getattr(self, name, default)
@@ -45,22 +45,26 @@
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 addHeader(self, name, value):
+
self.headers[name] = value
def setBody(self, body, is_error=0):
self.body = body
-
+
class HTTPBasicAuthHelperTests( unittest.TestCase
, ILoginPasswordHostExtractionPlugin_conformance
@@ -92,12 +96,12 @@
request = FauxHTTPRequest( 'foo', 'bar' )
self.assertEqual( helper.extractCredentials( request )
- , { 'login' : 'foo', 'password' : 'bar',
+ , { 'login' : 'foo', 'password' : 'bar',
'remote_host': '', 'remote_address': '' } )
def test_challenge( self ):
from zExceptions import Unauthorized
-
+
helper = self._makeOne()
request = FauxHTTPRequest()
response = FauxHTTPResponse()
@@ -105,9 +109,9 @@
self.failIf( response._unauthorized_called )
helper.challenge(request, response)
self.failUnless(response.status, 401)
- self.failUnless(response.headers['WWW-Authenticate'],
+ self.failUnless(response.headers['WWW-Authenticate'],
'basic realm="unit test"')
-
+
def test_resetCredentials( self ):
@@ -121,9 +125,8 @@
if __name__ == "__main__":
unittest.main()
-
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite( HTTPBasicAuthHelperTests ),
))
-
\ No newline at end of file
More information about the Zope-CVS
mailing list