mò 0á¸Ec@sëdZdkZdkZdkZdkZdkZdklZdkl Z dkl Z dk l Z dk l Z dZdZd Zd Ze e gZd eifd „ƒYZd eiefd„ƒYZdklZdklZdS(s\Default test case & fixture for Zope testing The fixture consists of: - a folder (self.folder) - a user folder inside that folder - a default user inside the user folder The default user is logged in and has the 'Access contents information' and 'View' permissions given to his role. $Id: ZopeTestCase.py 30326 2005-05-11 16:03:21Z shh $ N(sgetSecurityManager(snewSecurityManager(snoSecurityManager(saccess_contents_information(sviewttest_folder_1_t test_user_1_tsecrett test_role_1_t ZopeTestCasecBs†tZdZeieiifZdZd„Z d„Z d„Z d„Z dd„Z ed„Zed „Zed „Zd „ZRS( sBase test case for Zope testingicCs:|io,|iƒ|iƒ|iƒ|iƒndS(sHSets up the fixture. Framework authors may override. N(tselft_setup_fixturet _setupFoldert_setupUserFoldert _setupUsertlogin(R((t@/data/zmath/zope/lib/python/Testing/ZopeTestCase/ZopeTestCase.pyt_setup6s     cCsL|iitƒt|itƒ|_|iitƒ|iitt ƒdS(s"Creates and configures the folder.N( Rtapptmanage_addFoldert folder_nametgetattrtfoldert_addRolet user_rolet manage_roletstandard_permissions(R((R R@s cCs|iiƒdS(sCreates the user folder.N(RRtmanage_addUserFolder(R((R RGscCs)|ii}|itttggƒdS(sCreates the default user.N(RRt acl_userstuftuserFolderAddUsert user_namet user_passwordR(RR((R R Ks icCsLy+ti|iƒo|iitƒnWnnXtii||ƒdS(sClears the fixture.N( t connectionstcontainsRR t _delObjectRtbasetTestCaset_cleartcall_close_hook(RR"((R R!PscCs\|ii}|i|dti|ƒgƒ|t ƒi ƒi ƒjo|i |ƒndS(sChanges the user's roles.N(RRRRtuserFolderEditUsertnametNonetutilstmakelisttrolestgetSecurityManagertgetUsertgetIdR (RR(R$R((R tsetRoles\s  cCs |ii|ti|ƒƒdS(sChanges the user's permissions.N(RRRtroleR&R't permissions(RR.R-((R tsetPermissionscscCsO|ii}|i|ƒ}t|dƒp|i|ƒ}nt d|ƒdS(sLogs in.taq_baseN( RRRRt getUserByIdR$tuserthasattrt__of__tnewSecurityManagerR%(RR$R2R((R R gs  cCs tƒdS(s Logs out.N(tnoSecurityManager(R((R tlogoutos(t__name__t __module__t__doc__t interfacest IZopeSecurityRR t__implements__RR RRR R!RR,RR/R R7(((R R.s       tFunctionalTestCasecBs#tZdZeiieifZRS(s›Convenience base class for functional Zope tests You can mix-in Functional with every xTestCase to turn it into a functional test case. (R8R9R:t functionalt FunctionalR=R(((R R>ts (sapp(sclose(R:RR?R;R&Rt AccessControlR)t AccessControl.SecurityManagementR5R6tAccessControl.Permissionstaccess_contents_informationtviewRRRRRR RR@R>R tclose(R5RR)R;RDR?RRRRRRR6RFR RR&R>RE((R t?s&           F