mς 0αΈEc@s’dZdkZdkZdkZdklZdklZdklZdk l Z dZ dk l Z dk lZd eifd „ƒYZdS( s+Abstract base test case for working with CMF-style portals This class maintains a fixture consisting of: - a portal object (self.portal) - a user folder inside the portal - a default user with role 'Member' inside the user folder - the default user's memberarea (self.folder) - the default user is logged in The twist is that the portal object itself is *not* created by the PortalTestCase class! Subclasses must make sure getPortal() returns a usable portal object to the setup code. $Id: PortalTestCase.py 30565 2005-05-30 22:07:11Z shh $ N(sgetSecurityManager(snewSecurityManager(snoSecurityManager(saq_basetportal(s user_name(s user_passwordtPortalTestCasecBs­tZdZeieieiifZdZ d„Z d„Z d„Z d„Z d„Zd„Zd„Zd „Zd „Zed „Zd d „Zed„Zd„ZRS(s,Base test case for testing CMF-style portalsicCs[y@|iƒ|iƒ|_|iƒ|_|iƒ|iƒWn|iƒ‚nXdS(sPSets up the fixture. Do not override, use the hooks instead. N( tselft beforeSetUpt_apptappt_portalRt_setupt afterSetUpt_clear(R((tB/data/zmath/zope/lib/python/Testing/ZopeTestCase/PortalTestCase.pytsetUp5s   cCs |iƒS(s%Returns the portal object for a test.N(Rt getPortal(R((R RCscCs:|io,|iƒ|iƒ|iƒ|iƒndS(sJConfigures the portal. Framework authors may override. N(Rt_configure_portalt_setupUserFoldert _setupUsertlogint_setupHomeFolder(R((R RGs     cCs.tt|iƒdƒp|iiƒndS(s#Creates the user folder if missing.t acl_usersN(thasattrtaq_baseRRtmanage_addUserFolder(R((R RQscCs)|ii}|ittdggƒdS(sCreates the default user.tMemberN(RRRtuftuserFolderAddUsert user_namet user_password(RR((R RVs cCs/|itƒ|ii}|itƒ|_dS(s'Creates the default user's home folder.N(RtcreateMemberareaRRtportal_membershiptpmt getHomeFoldertfolder(RR((R R[s  cCsGtt|iƒdƒo|iiƒn d|i_|iiƒdS(sRefreshes the skin cache.tclearCurrentSkinN(RRRRR tNonet _v_skindatatsetupCurrentSkin(R((R t_refreshSkinDataas  cCst|itƒS(sαReturns the portal object to the setup code. Will typically be overridden by subclasses to return the object serving as the "portal". Note: This method should not be called by tests! N(tgetattrRRt portal_name(R((R R kscCsD|ii}tt|ƒdƒo|i|ƒn|i|ƒdS(sͺCreates a memberarea for the specified user. Subclasses may override to provide a customized or more lightweight version of the memberarea. tcreateMemberAreaN( RRRRRRR'tnameR(RR(R((R Rts  cCs\|ii}|i|dti|ƒgƒ|t ƒi ƒi ƒjo|i |ƒndS(sChanges the user's roles.N(RRRRtuserFolderEditUserR(R!tutilstmakelisttrolestgetSecurityManagertgetUsertgetIdR(RR,R(R((R tsetRoless  RcCs |ii|ti|ƒƒdS(s)Changes the permissions assigned to role.N(RRt manage_roletroleR*R+t permissions(RR3R2((R tsetPermissionsˆscCsO|ii}|i|ƒ}t|dƒp|i|ƒ}nt d|ƒdS(sLogs in.RN( RRRRt getUserByIdR(tuserRt__of__tnewSecurityManagerR!(RR(R6R((R RŒs  cCs tƒdS(s Logs out.N(tnoSecurityManager(R((R tlogout”s(t__name__t __module__t__doc__t interfacestIPortalTestCasetIPortalSecuritytbasetTestCaset__implements__R R RRRRRR$R RRR0R4RR:(((R R,s         (R=RAR>R*t AccessControlR-t AccessControl.SecurityManagementR8R9t AcquisitionRR&t ZopeTestCaseRRRBR( RR8RR-R>R&RRAR9RR*((R t?s