[Zope-CVS] CVS: Products/Ape/lib/apelib/tests -
testscanner.py:1.4.2.1 teststorage.py:1.6.2.1
Shane Hathaway
shane at zope.com
Thu Feb 26 11:33:01 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv11522/lib/apelib/tests
Modified Files:
Tag: ape-fs-oid-branch
testscanner.py teststorage.py
Log Message:
Re-enabled scanning.
It was necessary to defer scanning new objects until after transaction
commit.
=== Products/Ape/lib/apelib/tests/testscanner.py 1.4 => 1.4.2.1 ===
--- Products/Ape/lib/apelib/tests/testscanner.py:1.4 Tue Feb 17 00:25:12 2004
+++ Products/Ape/lib/apelib/tests/testscanner.py Thu Feb 26 11:32:30 2004
@@ -156,34 +156,18 @@
self.assertEqual(self.scanner.current[5], sources)
def testUseCommittedSources(self):
- # Verify the scanner sees sources according to transactions.
+ # Verify the scanner updates sources according to transactions.
repo = FakeRepository()
sources = {(repo, '999'): -1}
self.scanner.afterLoad(5, sources)
self.conn1.setOIDs([5])
sources_2 = {(repo, '999'): -2}
- self.scanner.afterStore(5, 123, sources_2)
- # Uncommitted data should have no effect on sources
- self.assertEqual(self.scanner.current[5], sources)
- self.scanner.afterCommit(123)
- # The scanner should have used data from the repo rather
- # than "-2".
+ self.scanner.afterCommit(5, sources_2)
final_sources = self.scanner.current[5]
self.assertEqual(len(final_sources), 1)
self.assertEqual(final_sources.keys()[0], (repo, '999'))
- self.assertEqual(final_sources.values()[0], 1001)
+ self.assertEqual(final_sources.values()[0], -2)
- def testAbort(self):
- # Verify the scanner ignores sources on transaction abort.
- repo = FakeRepository()
- sources = {(repo, '999'): -2}
- self.scanner.afterStore(5, 123, sources)
- self.assertEqual(self.scanner.uncommitted[123][5], sources)
- self.scanner.afterAbort(123)
- self.assert_(not self.scanner.uncommitted.has_key(123))
- self.assert_(not self.scanner.current.has_key(123))
- self.assert_(not self.scanner.future.has_key(123))
-
if __name__ == '__main__':
unittest.main()
=== Products/Ape/lib/apelib/tests/teststorage.py 1.6 => 1.6.2.1 ===
--- Products/Ape/lib/apelib/tests/teststorage.py:1.6 Mon Feb 2 10:07:22 2004
+++ Products/Ape/lib/apelib/tests/teststorage.py Thu Feb 26 11:32:30 2004
@@ -369,6 +369,19 @@
self.assertRaises(KeyError, self.storage.getPollSources, oid)
+ def testCleanChanged(self):
+ # Verify the storage discards the list of changed objects on
+ # commit or abort.
+ conn1 = self.db.open()
+ try:
+ ob1 = self._writeBasicObject(conn1)
+ self.assertEqual(len(self.storage.changed), 0)
+ ob1.strdata = 'def'
+ get_transaction().abort()
+ self.assertEqual(len(self.storage.changed), 0)
+ finally:
+ conn1.close()
+
+
if __name__ == '__main__':
unittest.main()
-
More information about the Zope-CVS
mailing list