[Zope-CVS] CVS: Products/PluggableAuthService/tests -
test_PluggableAuthService.py:1.13.2.1
Jens Vagelpohl
jens at dataflake.org
Wed Oct 27 02:35:50 EDT 2004
Update of /cvs-repository/Products/PluggableAuthService/tests
In directory cvs.zope.org:/tmp/cvs-serv32266/tests
Modified Files:
Tag: jens-implement_caching_branch
test_PluggableAuthService.py
Log Message:
- fix bugs uncovered by unit tests
- disable tests that exercise the "old" cache for now
=== Products/PluggableAuthService/tests/test_PluggableAuthService.py 1.13 => 1.13.2.1 ===
--- Products/PluggableAuthService/tests/test_PluggableAuthService.py:1.13 Sat Oct 16 16:15:46 2004
+++ Products/PluggableAuthService/tests/test_PluggableAuthService.py Wed Oct 27 02:35:50 2004
@@ -632,67 +632,67 @@
self.assertEqual( len( user_ids ), 1 )
self.assertEqual( user_ids[ 0 ][0], 'login__foo' )
- def test__extractUserIds_cache( self ):
+ #def test__extractUserIds_cache( self ):
- from Products.PluggableAuthService.interfaces.plugins \
- import IExtractionPlugin, IAuthenticationPlugin
+ # from Products.PluggableAuthService.interfaces.plugins \
+ # import IExtractionPlugin, IAuthenticationPlugin
- plugins = self._makePlugins()
- zcuf = self._makeOne( plugins )
+ # plugins = self._makePlugins()
+ # zcuf = self._makeOne( plugins )
- login = DummyPlugin()
- directlyProvides( login, ( IExtractionPlugin, IAuthenticationPlugin ) )
- login.extractCredentials = _extractLogin
- login.authenticateCredentials = _authLogin
-
- zcuf._setObject( 'login', login )
-
- extra = DummyPlugin()
- directlyProvides( extra, ( IExtractionPlugin, IAuthenticationPlugin ) )
- extra.extractCredentials = _extractExtra
- extra.authenticateCredentials = _authExtra
+ # login = DummyPlugin()
+ # directlyProvides( login, ( IExtractionPlugin, IAuthenticationPlugin ) )
+ # login.extractCredentials = _extractLogin
+ # login.authenticateCredentials = _authLogin
- zcuf._setObject( 'extra', extra )
+ # zcuf._setObject( 'login', login )
- plugins = zcuf._getOb( 'plugins' )
+ # extra = DummyPlugin()
+ # directlyProvides( extra, ( IExtractionPlugin, IAuthenticationPlugin ) )
+ # extra.extractCredentials = _extractExtra
+ # extra.authenticateCredentials = _authExtra
- plugins.activatePlugin( IExtractionPlugin, 'extra' )
- plugins.activatePlugin( IExtractionPlugin, 'login' )
- plugins.activatePlugin( IAuthenticationPlugin, 'extra' )
- plugins.activatePlugin( IAuthenticationPlugin, 'login' )
-
- cache = {}
- request = FauxRequest( form={ 'login' : 'foo' , 'password' : 'bar' }
- , extra='qux'
- )
+ # zcuf._setObject( 'extra', extra )
+
+ # plugins = zcuf._getOb( 'plugins' )
+
+ # plugins.activatePlugin( IExtractionPlugin, 'extra' )
+ # plugins.activatePlugin( IExtractionPlugin, 'login' )
+ # plugins.activatePlugin( IAuthenticationPlugin, 'extra' )
+ # plugins.activatePlugin( IAuthenticationPlugin, 'login' )
+
+ # cache = {}
+ # request = FauxRequest( form={ 'login' : 'foo' , 'password' : 'bar' }
+ # , extra='qux'
+ # )
- user_ids = zcuf._extractUserIds( request=request
- , plugins=zcuf.plugins
- , cache=cache
- )
-
- self.assertEqual( len( user_ids ), 2 )
- self.assertEqual( user_ids[ 0 ][0], 'extra__qux' )
- self.assertEqual( user_ids[ 1 ][0], 'login__foo' )
-
- self.assertEqual( len( cache ), 2 )
- self.failUnless( [ ('login__foo', 'foo') ] in cache.values() )
- self.failUnless( [ ('extra__qux', 'qux') ] in cache.values() )
-
- key = [ x[0] for x in cache.items()
- if x[1] == [('login__foo', 'foo')] ][0]
- cache[ key ].append( ('forced__baz', 'baz' ) )
-
- user_ids = zcuf._extractUserIds( request=request
- , plugins=zcuf.plugins
- , cache=cache
- )
-
- self.assertEqual( len( user_ids ), 3, user_ids )
- self.assertEqual( user_ids[ 0 ][0], 'extra__qux' )
- self.assertEqual( user_ids[ 1 ][0], 'login__foo' )
- self.assertEqual( user_ids[ 2 ][0], 'forced__baz' )
+ # user_ids = zcuf._extractUserIds( request=request
+ # , plugins=zcuf.plugins
+ # , cache=cache
+ # )
+
+ # self.assertEqual( len( user_ids ), 2 )
+ # self.assertEqual( user_ids[ 0 ][0], 'extra__qux' )
+ # self.assertEqual( user_ids[ 1 ][0], 'login__foo' )
+
+ # self.assertEqual( len( cache ), 2 )
+ # self.failUnless( [ ('login__foo', 'foo') ] in cache.values() )
+ # self.failUnless( [ ('extra__qux', 'qux') ] in cache.values() )
+
+ # key = [ x[0] for x in cache.items()
+ # if x[1] == [('login__foo', 'foo')] ][0]
+ # cache[ key ].append( ('forced__baz', 'baz' ) )
+
+ # user_ids = zcuf._extractUserIds( request=request
+ # , plugins=zcuf.plugins
+ # , cache=cache
+ # )
+
+ # self.assertEqual( len( user_ids ), 3, user_ids )
+ # self.assertEqual( user_ids[ 0 ][0], 'extra__qux' )
+ # self.assertEqual( user_ids[ 1 ][0], 'login__foo' )
+ # self.assertEqual( user_ids[ 2 ][0], 'forced__baz' )
def test__getObjectContext_no_steps( self ):
@@ -1027,27 +1027,27 @@
self.failIf( 'bar:group3' in groups )
self.failIf( 'bar:group4' in groups )
- def test__findUser_from_cache( self ):
+ #def test__findUser_from_cache( self ):
- plugins = self._makePlugins()
- zcuf = self._makeOne(plugins)
- faux = FauxUser( 'faux' )
- cache = { 'faux' : faux }
+ # plugins = self._makePlugins()
+ # zcuf = self._makeOne(plugins)
+ # faux = FauxUser( 'faux' )
+ # cache = { 'faux' : faux }
- user = zcuf._findUser( plugins, 'faux', 'faux', cache )
+ # user = zcuf._findUser( plugins, 'faux', 'faux', cache )
- self.failUnless( aq_base( user ) is faux )
- self.failUnless( aq_parent( user ) is zcuf )
+ # self.failUnless( aq_base( user ) is faux )
+ # self.failUnless( aq_parent( user ) is zcuf )
- def test__findUser_loads_cache( self ):
+ #def test__findUser_loads_cache( self ):
- plugins = self._makePlugins()
+ # plugins = self._makePlugins()
- zcuf = self._makeOne(plugins)
- cache = {}
- user = zcuf._findUser( plugins, 'someone', 'someone', cache )
+ # zcuf = self._makeOne(plugins)
+ # cache = {}
+ # user = zcuf._findUser( plugins, 'someone', 'someone', cache )
- self.failUnless( aq_base(cache[ 'someone' ]) is aq_base( user ) )
+ # self.failUnless( aq_base(cache[ 'someone' ]) is aq_base( user ) )
def test__authorizeUser_force_ok( self ):
More information about the Zope-CVS
mailing list