[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py These tests aare a little odd because they use DemoStorage and use

Jim Fulton jim at zope.com
Sat Apr 28 11:31:35 EDT 2007


Log message for revision 74880:
  These tests aare a little odd because they use DemoStorage and use
  it's undoInfo even though DemoStorage doesn't support undo.  If a
  storage doesn't support undo, databases no-longer expose the storage's
  undo methods.  We could work aroud this by not using a demo storage or
  by calling the storage method directly.  Note also that all but one of
  these tests could use lastTransaction rather than undoInfo.
  

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-04-28 13:40:45 UTC (rev 74879)
+++ Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2007-04-28 15:31:34 UTC (rev 74880)
@@ -389,7 +389,7 @@
         class FooError(Exception):
             pass
 
-        last_txn_info = self.db.undoInfo()[0]
+        last_txn_info = self.storage.undoInfo()[0]
         try:
             raise FooError
         except FooError:
@@ -398,7 +398,7 @@
             self.object, self.request, sys.exc_info(), retry_allowed=False)
 
         # assert that the last transaction is NOT our transaction
-        new_txn_info = self.db.undoInfo()[0]
+        new_txn_info = self.storage.undoInfo()[0]
         self.assertEqual(last_txn_info, new_txn_info)
 
         # instead, we expect a message in our logging utility
@@ -464,10 +464,10 @@
         # 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]
+        last_txn_info = self.storage.undoInfo()[0]
         self.publication.afterCall(self.request, self.object)
         self.assert_(txn is not transaction.get())
-        new_txn_info = self.db.undoInfo()[0]
+        new_txn_info = self.storage.undoInfo()[0]
         self.failIfEqual(last_txn_info, new_txn_info)
 
     def testDoomedTransaction(self):
@@ -477,13 +477,13 @@
         # 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]
+        last_txn_info = self.storage.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]
+        new_txn_info = self.storage.undoInfo()[0]
         # No transaction should be committed
         self.assertEqual(last_txn_info, new_txn_info)
 
@@ -511,7 +511,7 @@
         expected_request = IRequest.__module__ + '.' + IRequest.getName()
 
         self.publication.afterCall(self.request, bar)
-        txn_info = self.db.undoInfo()[0]
+        txn_info = self.storage.undoInfo()[0]
         self.assertEqual(txn_info['location'], expected_path)
         self.assertEqual(txn_info['user_name'], expected_user)
         self.assertEqual(txn_info['request_type'], expected_request)



More information about the Zope3-Checkins mailing list