Back to index

plone3  3.1.7
sessioncase.py
Go to the documentation of this file.
00001 from Testing import ZopeTestCase
00002 from Products.Five import zcml
00003 
00004 import plone.session
00005 from plone.session.plugins.session import SessionPlugin
00006 from plone.session.tests.layer import PloneSession
00007 
00008 from OFS.Folder import Folder
00009 
00010 
00011 class FakePAS(Folder):
00012     plugins = None
00013 
00014     def updateCredentials(self, request, response, userid, password):
00015         self.credentials=(userid, password)
00016 
00017 
00018     def _verifyUser(self, plugin, user_id=None, login=None):
00019         assert user_id is None
00020         if login=='our_user':
00021             return dict(id=user_id, login=user_id, pluginid="session")
00022         return None
00023 
00024 
00025 class PloneSessionTestCase(ZopeTestCase.ZopeTestCase):
00026 
00027     layer = PloneSession
00028 
00029     def afterSetUp(self):
00030         zcml.load_config('configure.zcml', plone.session)
00031         self.folder._setObject("pas", FakePAS("pas"))
00032         self.folder.pas._setObject("session", SessionPlugin("session"))
00033 
00034 
00035 class FunctionalPloneSessionTestCase(ZopeTestCase.Functional, PloneSessionTestCase):
00036     pass
00037