Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
PluggableAuthService.plugins.tests.test_HTTPBasicAuthHelper.HTTPBasicAuthHelperTests Class Reference
Inheritance diagram for PluggableAuthService.plugins.tests.test_HTTPBasicAuthHelper.HTTPBasicAuthHelperTests:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.tests.test_HTTPBasicAuthHelper.HTTPBasicAuthHelperTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_extractCredentials_no_creds
def test_extractCredentials_with_creds
def test_challenge
def test_resetCredentials

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 73 of file test_HTTPBasicAuthHelper.py.


Member Function Documentation

Definition at line 75 of file test_HTTPBasicAuthHelper.py.

00075 
00076     def _getTargetClass( self ):
00077 
00078         from Products.PluggableAuthService.plugins.HTTPBasicAuthHelper \
00079             import HTTPBasicAuthHelper
00080 
00081         return HTTPBasicAuthHelper

def PluggableAuthService.plugins.tests.test_HTTPBasicAuthHelper.HTTPBasicAuthHelperTests._makeOne (   self,
  id = 'test',
  args,
  kw 
) [private]

Definition at line 82 of file test_HTTPBasicAuthHelper.py.

00082 
00083     def _makeOne( self, id='test', *args, **kw ):
00084 
00085         return self._getTargetClass()( id=id, *args, **kw )

Definition at line 102 of file test_HTTPBasicAuthHelper.py.

00102 
00103     def test_challenge( self ):
00104         from zExceptions import Unauthorized
00105 
00106         helper = self._makeOne()
00107         request = FauxHTTPRequest()
00108         response = FauxHTTPResponse()
00109 
00110         self.failIf( response._unauthorized_called )
00111         helper.challenge(request, response)
00112         self.failUnless(response.status, 401)
00113         self.failUnless(response.headers['WWW-Authenticate'],
00114             'basic realm="unit test"')
00115 

Definition at line 86 of file test_HTTPBasicAuthHelper.py.

00086 
00087     def test_extractCredentials_no_creds( self ):
00088 
00089         helper = self._makeOne()
00090         request = FauxHTTPRequest()
00091 
00092         self.assertEqual( helper.extractCredentials( request ), {} )

Definition at line 93 of file test_HTTPBasicAuthHelper.py.

00093 
00094     def test_extractCredentials_with_creds( self ):
00095 
00096         helper = self._makeOne()
00097         request = FauxHTTPRequest( 'foo', 'bar' )
00098 
00099         self.assertEqual( helper.extractCredentials( request )
00100                         , { 'login' : 'foo', 'password' : 'bar',
00101                             'remote_host': '', 'remote_address': '' } )

Definition at line 116 of file test_HTTPBasicAuthHelper.py.

00116 
00117     def test_resetCredentials( self ):
00118 
00119         helper = self._makeOne()
00120         request = FauxHTTPRequest()
00121         response = FauxHTTPResponse()
00122 
00123         self.failIf( response._unauthorized_called )
00124         helper.resetCredentials( request, response )
00125         self.failUnless( response._unauthorized_called )


The documentation for this class was generated from the following file: