mς 0αΈEc@s₯dZdkZdkZedjo$eeiieiddƒƒndklZdk Z dk l Z dk l Z dk Z eiZe e gZdeifd „ƒYZd eifd „ƒYZd klZd efd„ƒYZeiƒZeideƒƒeideƒƒe iƒeieƒdeifd„ƒYZdeifd„ƒYZdeifd„ƒYZd„Zedjo eƒndS(sπTests ZODB behavior in ZopeTestCase Demonstrates that cut/copy/paste/clone/rename and import/export work if a subtransaction is committed before performing the respective operation. $Id: testZODBCompat.py 39884 2005-11-04 10:24:10Z shh $ Nt__main__is framework.py(s ZopeTestCase(sadd_documents_images_and_files(sdelete_objectst TestCopyPastecBsGtZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsc|itƒ|iidddƒ|i|iidƒti dt ƒ|i |iidƒdS(Ntdoctfiletfoot optimistic( tselftsetPermissionstcutpaste_permissionstfoldert addDTMLMethodt assertEqualt_p_oidtNonet transactiont savepointtTruet failIfEqual(R((tB/data/zmath/zope/lib/python/Testing/ZopeTestCase/testZODBCompat.pyt afterSetUp(s  cCs[|iidgƒ}|ii|ƒ|it|idƒƒ|it|idƒƒdS(NRt copy_of_doc(RR tmanage_cutObjectstcbtmanage_pasteObjectst failUnlessthasattrtfailIf(RR((Rt testCutPaste0scCs[|iidgƒ}|ii|ƒ|it|idƒƒ|it|idƒƒdS(NRR(RR tmanage_copyObjectsRRRR(RR((Rt testCopyPaste6scCsO|ii|iidƒ|it|idƒƒ|it|idƒƒdS(Ntnew_docR(RR t manage_cloneRRR(R((Rt testClone<scCsO|iidgdgƒ|it|idƒƒ|it|idƒƒdS(NRR(RR tmanage_renameObjectsRRR(R((Rt testRenameAscCsy|ii}d|idRIR?RKR@(R5tremoveRR8tOSErrortrmdirRBRCRDRERFRGRHRRIRKRLRMRNRORP(RRHRLRD((Rt afterClear‰s, (R0R1RR9R<ttempfilet gettempdirRJR5R6tjoinRBR8R3RT(((RR2Ys    (s SimpleItemt DummyObjectcBs tZdZdZdZdZRS(Ntdummy(R0R1tidR Rt_v_foot_p_foo(((RRX₯stdummy1tdummy2tTestAttributesOfCleanObjectscBshtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( siThis testcase shows that _v_ and _p_ attributes are NOT bothered by transaction boundaries, if the respective object is otherwise left untouched (clean). This means that such variables will keep their values across tests. The only use case yet encountered in the wild is portal_memberdata's _v_temps attribute. Test authors are cautioned to watch out for occurrences of _v_ and _p_ attributes of objects that are not recreated for every test method execution, but preexist in the test ZODB. It is therefore deemed essential to initialize any _v_ and _p_ attributes of such objects in afterSetup(), as otherwise test results will be distorted! Note that _v_ attributes used to be transactional in Zope < 2.6. This testcase exploits the fact that test methods are sorted by name. cCs|ii|_dS(N(RR&R]RY(R((RRΖscCs&|i|iidƒd|i_dS(NR(RR RYRR (R((Rt testNormal_01ΙscCs&|i|iidƒd|i_dS(Ntbar(RR RYRR (R((Rt testNormal_02ΞscCs|i|iidƒdS(N(RR RYRR (R((Rt testNormal_03ΣscCs&|i|iidƒd|i_dS(NR(RR RYR\R (R((RttestPersistent_01ΧscCs&|i|iidƒd|i_dS(NRRa(RR RYR\(R((RttestPersistent_02άscCs|i|iidƒdS(NRa(RR RYR\(R((RttestPersistent_03αscCs&|i|iidƒd|i_dS(NR(RR RYR[R (R((RttestVolatile_01εscCsVt|iidƒo|i|iidƒn|i|iidƒd|i_dS(NtregisterRRa(RRR&t_p_jarR RYR[R (R((RttestVolatile_02κscCsJt|iidƒo|i|iidƒn|i|iidƒdS(NRhRa(RRR&RiR RYR[R (R((RttestVolatile_03σs( R0R1t__doc__RR`RbRcRdReRfRgRjRk(((RR_²s          tTestAttributesOfDirtyObjectscBshtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( s±This testcase shows that _v_ and _p_ attributes of dirty objects ARE removed on abort. This testcase exploits the fact that test methods are sorted by name. cCs|ii|_d|i_dS(Ni(RR&R^RYttouchme(R((RRscCs&|i|iidƒd|i_dS(NR(RR RYRR (R((RttestDirtyNormal_01scCs&|i|iidƒd|i_dS(NRa(RR RYRR (R((RttestDirtyNormal_02 scCs|i|iidƒdS(N(RR RYRR (R((RttestDirtyNormal_03scCs&|i|iidƒd|i_dS(NR(RR RYR\R (R((RttestDirtyPersistent_01scCs&|i|iidƒd|i_dS(NRa(RR RYR\R (R((RttestDirtyPersistent_02scCs|i|iidƒdS(N(RR RYR\R (R((RttestDirtyPersistent_03scCs&|i|iidƒd|i_dS(NR(RR RYR[R (R((RttestDirtyVolatile_01#scCs&|i|iidƒd|i_dS(NRa(RR RYR[R (R((RttestDirtyVolatile_02(scCs|i|iidƒdS(N(RR RYR[R (R((RttestDirtyVolatile_03-s( R0R1RlRRoRpRqRrRsRtRuRvRw(((RRmόs          tTestTransactionAbortcBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsLd|i_|it|idƒƒtiƒ|it|idƒƒdS(NiR(RR RRRRtabort(R((RttestTransactionAbort4s  cCs\d|i_|it|idƒƒtidtƒtiƒ|i t|idƒƒdS(NiRR( RR RRRRRRRyR(R((RttestSubTransactionAbort;s   cCsLd|i_|it|idƒƒtiƒ|it|idƒƒdS(NiR\(RR R\RRRRy(R((RttestTransactionAbortPersistentCs  cCs\d|i_|it|idƒƒtidtƒtiƒ|i t|idƒƒdS(NiR\R( RR R\RRRRRRyR(R((Rt!testSubTransactionAbortPersistentJs   cCsLd|i_|it|idƒƒtiƒ|it|idƒƒdS(NiR[(RR R[RRRRy(R((RttestTransactionAbortVolatileRs  cCs\d|i_|it|idƒƒtidtƒtiƒ|i t|idƒƒdS(NiR[R( RR R[RRRRRRyR(R((RttestSubTransactionAbortVolatileYs   (R0R1RzR{R|R}R~R(((RRx2s      cCsdkl}l}|ƒ}|i|tƒƒ|i|tƒƒ|i|tƒƒ|i|tƒƒ|i|t ƒƒ|S(N(s TestSuites makeSuite( tunittestt TestSuitet makeSuitetsuitetaddTestRR2R_RmRx(RR‚Rƒ((Rt test_suitebs (RlR5tsysR0texecfileR6RWtTestingt ZopeTestCaseRtAccessControl.Permissionstadd_documents_images_and_filestdelete_objectsRUR*RRR2tOFS.SimpleItemt SimpleItemRXR&t _setObjecttcommittcloseR_RmRxR…t framework(RRxRRR2RŒRŽR‰R&R‹R†RURXR…R*RmR_R5((Rt?s2 $       3J    J60