Back to index

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

List of all members.

Public Member Functions

def test_extractCredentials_no_creds
def test_extractCredentials_with_getClientAddr
def test_extractCredentials_no_getClientAddr_with_REMOTE_ADDR
def test_extractCredentials_with_getClientAddr_no_REMOTE_HSOT
def test_extractCredentials_with_REMOTE_ADDR_no_REMOTE_HOST
def test_extractCredentials_no_getClientAddr_no_REMOTE_ADDR
def test_authenticateCredentials_empty_mapping_empty_creds
def test_authenticateCredentials_empty_mapping_nonesuch_remote_host
def test_authenticateCredentials_empty_mapping_nonesuch_remote_addr
def test_authenticateCredentials_w_mapping_known_remote_host
def test_authenticateCredentials_w_mapping_known_remote_addr
def test_authenticateCredentials_w_mapping_no_login_known_remote_host

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 41 of file test_DomainAuthHelper.py.


Member Function Documentation

Definition at line 43 of file test_DomainAuthHelper.py.

00043 
00044     def _getTargetClass( self ):
00045 
00046         from Products.PluggableAuthService.plugins.DomainAuthHelper \
00047             import DomainAuthHelper
00048 
00049         return DomainAuthHelper

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

Definition at line 50 of file test_DomainAuthHelper.py.

00050 
00051     def _makeOne( self, id='test', *args, **kw ):
00052 
00053         return self._getTargetClass()( id=id, *args, **kw )

Definition at line 108 of file test_DomainAuthHelper.py.

00108 
00109     def test_authenticateCredentials_empty_mapping_empty_creds(self):
00110         creds = {}
00111         helper = self._makeOne()
00112         self.assertEqual(helper.authenticateCredentials(creds), (None, None))

Definition at line 118 of file test_DomainAuthHelper.py.

00118 
00119     def test_authenticateCredentials_empty_mapping_nonesuch_remote_addr(self):
00120         creds = {'remote_address': 'bam'}
00121         helper = self._makeOne()
00122         self.assertEqual(helper.authenticateCredentials(creds), (None, None))

Definition at line 113 of file test_DomainAuthHelper.py.

00113 
00114     def test_authenticateCredentials_empty_mapping_nonesuch_remote_host(self):
00115         creds = {'remote_host': 'foo'}
00116         helper = self._makeOne()
00117         self.assertEqual(helper.authenticateCredentials(creds), (None, None))

Definition at line 133 of file test_DomainAuthHelper.py.

00133 
00134     def test_authenticateCredentials_w_mapping_known_remote_addr(self):
00135         from Products.PluggableAuthService.plugins.DomainAuthHelper \
00136             import _MATCH_ENDSWITH
00137 
00138         creds = {'login': 'qux', 'remote_address': 'baz'}
00139         helper = self._makeOne()
00140         helper.manage_addMapping(match_type=_MATCH_ENDSWITH,
00141                                  match_string='z',
00142                                  username='foo',
00143                                 )
00144 
00145         self.assertEqual(helper.authenticateCredentials(creds), ('qux', 'qux'))

Definition at line 123 of file test_DomainAuthHelper.py.

00123 
00124     def test_authenticateCredentials_w_mapping_known_remote_host(self):
00125         from Products.PluggableAuthService.plugins.DomainAuthHelper \
00126             import _MATCH_EQUALS
00127 
00128         creds = {'login': 'qux', 'remote_host': 'bam'}
00129         helper = self._makeOne()
00130         helper.manage_addMapping(match_type=_MATCH_EQUALS, match_string='bam')
00131 
00132         self.assertEqual(helper.authenticateCredentials(creds), ('qux', 'qux'))

Definition at line 146 of file test_DomainAuthHelper.py.

00146 
00147     def test_authenticateCredentials_w_mapping_no_login_known_remote_host(self):
00148         from Products.PluggableAuthService.plugins.DomainAuthHelper \
00149             import _MATCH_EQUALS
00150 
00151         creds = {'remote_host': 'baz'}
00152         helper = self._makeOne()
00153         helper.manage_addMapping(match_type=_MATCH_EQUALS,
00154                                  match_string='baz',
00155                                  username='foo',
00156                                 )
00157 
00158         self.assertEqual(helper.authenticateCredentials(creds), ('foo', 'foo'))

Definition at line 54 of file test_DomainAuthHelper.py.

00054 
00055     def test_extractCredentials_no_creds( self ):
00056 
00057         helper = self._makeOne()
00058         request = FauxRequest()
00059 
00060         self.assertEqual( helper.extractCredentials( request ), {} )

Definition at line 99 of file test_DomainAuthHelper.py.

00099 
00100     def test_extractCredentials_no_getClientAddr_no_REMOTE_ADDR( self ):
00101 
00102         helper = self._makeOne()
00103         request = FauxRequest(REMOTE_HOST='foo')
00104 
00105         self.assertEqual(helper.extractCredentials(request),
00106                         {'remote_host': 'foo',
00107                          'remote_address': ''})

Definition at line 71 of file test_DomainAuthHelper.py.

00071 
00072     def test_extractCredentials_no_getClientAddr_with_REMOTE_ADDR( self ):
00073 
00074         helper = self._makeOne()
00075         request = FauxRequest(REMOTE_HOST='foo',
00076                               REMOTE_ADDR='bam')
00077 
00078         self.assertEqual(helper.extractCredentials(request),
00079                         {'remote_host': 'foo',
00080                          'remote_address': 'bam'})

Definition at line 61 of file test_DomainAuthHelper.py.

00061 
00062     def test_extractCredentials_with_getClientAddr( self ):
00063 
00064         helper = self._makeOne()
00065         request = FauxRequestWithClientAddr(REMOTE_HOST='foo',
00066                                             CLIENT_ADDR='bar')
00067 
00068         self.assertEqual(helper.extractCredentials(request),
00069                         {'remote_host': 'foo',
00070                          'remote_address': 'bar'})

Definition at line 81 of file test_DomainAuthHelper.py.

00081 
00082     def test_extractCredentials_with_getClientAddr_no_REMOTE_HSOT( self ):
00083 
00084         helper = self._makeOne()
00085         request = FauxRequestWithClientAddr(CLIENT_ADDR='bar')
00086 
00087         self.assertEqual(helper.extractCredentials(request),
00088                         {'remote_host': '',
00089                          'remote_address': 'bar'})

Definition at line 90 of file test_DomainAuthHelper.py.

00090 
00091     def test_extractCredentials_with_REMOTE_ADDR_no_REMOTE_HOST( self ):
00092 
00093         helper = self._makeOne()
00094         request = FauxRequest(REMOTE_ADDR='bam')
00095 
00096         self.assertEqual(helper.extractCredentials(request),
00097                         {'remote_host': '',
00098                          'remote_address': 'bam'})


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