[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py Add a test for my commit in 72976 (It fails without that patch).

Brian Sutherland jinty at web.de
Sat Mar 10 07:34:09 EST 2007


Log message for revision 73135:
  Add a test for my commit in 72976 (It fails without that patch).

Changed:
  U   Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py

-=-
Modified: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2007-03-10 01:56:54 UTC (rev 73134)
+++ Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2007-03-10 12:34:07 UTC (rev 73135)
@@ -206,8 +206,6 @@
                          'in testRetryNotAllowed raise Retry'
                          ' Retry: None')
 
-
-
     def testViewOnException(self):
         from zope.interface import Interface
         class E1(Exception):
@@ -467,6 +465,23 @@
         new_txn_info = self.db.undoInfo()[0]
         self.failIfEqual(last_txn_info, new_txn_info)
 
+    def testDoomedTransaction(self):
+        # Test that a doomed transaction is aborted without error in afterCall
+        root = self.db.open().root()
+        txn = transaction.get()
+        # we just need a change in the database to make the
+        # transaction notable in the undo log
+        root['foo'] = object()
+        last_txn_info = self.db.undoInfo()[0]
+        # doom the transaction
+        txn.doom()
+        self.publication.afterCall(self.request, self.object)
+        # assert that we get a new transaction
+        self.assert_(txn is not transaction.get())
+        new_txn_info = self.db.undoInfo()[0]
+        # No transaction should be committed
+        self.assertEqual(last_txn_info, new_txn_info)
+
     def testTransactionAnnotation(self):
         from zope.interface import directlyProvides
         from zope.location.traversing import LocationPhysicallyLocatable



More information about the Zope3-Checkins mailing list