[Zope-Checkins]
SVN: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testZODBCompat.py
Added two more tests for transaction.abort().
Stefan H. Holek
stefan at epy.co.at
Wed Dec 21 16:09:28 EST 2005
Log message for revision 40967:
Added two more tests for transaction.abort().
Changed:
U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testZODBCompat.py
-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testZODBCompat.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testZODBCompat.py 2005-12-21 21:00:38 UTC (rev 40966)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testZODBCompat.py 2005-12-21 21:09:27 UTC (rev 40967)
@@ -27,6 +27,7 @@
import transaction
+from Acquisition import aq_base
from AccessControl.Permissions import add_documents_images_and_files
from AccessControl.Permissions import delete_objects
import tempfile
@@ -350,7 +351,24 @@
# This time the abort nukes the _v_foo attribute...
self.failIf(hasattr(self.folder, '_v_foo'))
+ def testTransactionAbortClassAttribute(self):
+ self.folder.id = 'bar'
+ self.failUnless(hasattr(aq_base(self.folder), 'id'))
+ transaction.abort()
+ # The id attribute is still present
+ self.assertEqual(getattr(aq_base(self.folder), 'id', None), 'bar')
+ def testSubTransactionAbortClassAttribute(self):
+ self.folder.id = 'bar'
+ self.failUnless(hasattr(aq_base(self.folder), 'id'))
+ transaction.commit(1)
+ transaction.abort()
+ # The id attribute is still present but has been
+ # reset to the class default
+ self.failUnless(hasattr(aq_base(self.folder), 'id'))
+ self.assertEqual(getattr(aq_base(self.folder), 'id', None), '')
+
+
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
More information about the Zope-Checkins
mailing list