[Zope-CVS] CVS: Products/AdaptableStorage/tests - Zope2TestBase.py:1.4.2.2 testASStorage.py:1.4.2.2
Christian Zagrodnick
cz@gocept.com
Tue, 21 Jan 2003 03:11:55 -0500
Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv25960/tests
Modified Files:
Tag: zagy-patches
Zope2TestBase.py testASStorage.py
Log Message:
merging HEAD into zagy-patches branch
=== Products/AdaptableStorage/tests/Zope2TestBase.py 1.4.2.1 => 1.4.2.2 ===
--- Products/AdaptableStorage/tests/Zope2TestBase.py:1.4.2.1 Mon Jan 13 14:16:22 2003
+++ Products/AdaptableStorage/tests/Zope2TestBase.py Tue Jan 21 03:11:22 2003
@@ -16,12 +16,15 @@
$Id$
"""
+from cStringIO import StringIO
+
from Acquisition import aq_base
from ZODB import Persistent, POSException
from Persistence import PersistentMapping
from OFS.Folder import Folder
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
+from OFS.Image import manage_addFile
from AccessControl.User import User, UserFolder
from Products.AdaptableStorage.patches import applySetObPatch
@@ -300,3 +303,25 @@
finally:
conn.close()
+
+
+ def testLargeFile(self):
+ # Verify that 256K file objects can be serialized/deserialized.
+ # Zope splits files larger than 64K into chunks.
+ data = 'data' * 65536
+ conn = self.db.open()
+ try:
+ app = conn.root()['Application']
+ manage_addFile(app, 'file', StringIO(data))
+ get_transaction().commit()
+
+ self.assertEqual(str(app.file), data)
+ conn2 = self.db.open()
+ try:
+ app = conn2.root()['Application']
+ self.assertEqual(str(app.file), data)
+ finally:
+ conn2.close()
+ finally:
+ conn.close()
+
=== Products/AdaptableStorage/tests/testASStorage.py 1.4.2.1 => 1.4.2.2 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.4.2.1 Mon Jan 13 14:16:22 2003
+++ Products/AdaptableStorage/tests/testASStorage.py Tue Jan 21 03:11:22 2003
@@ -257,6 +257,34 @@
conn1.close()
+ def testRemainderCyclicReferenceRestoration(self):
+ # test whether the remainder pickler properly stores cyclic references
+ # back to the object itself.
+ ob1 = PersistentMapping()
+ ob1.myself = ob1
+
+ dummy = PersistentMapping()
+ dummy.strdata = ''
+
+ conn1 = self.db.open()
+ try:
+ root = conn1.root()
+ get_transaction().begin()
+ root['TestRoot'] = dummy
+ root['TestRoot2'] = ob1
+ get_transaction().commit()
+
+ conn2 = self.db.open()
+ try:
+ ob2 = conn2.root()['TestRoot2']
+ self.assert_(ob2.myself is ob2)
+ self.assert_(ob2 is not ob1) # Verify it didn't cheat somehow
+ finally:
+ conn2.close()
+ finally:
+ conn1.close()
+
+
if __name__ == '__main__':
unittest.main()