[Zope-CVS] CVS: Products/AdaptableStorage/tests - testZope2FS.py:1.11
Shane Hathaway
shane@zope.com
Mon, 6 Jan 2003 10:37:23 -0500
Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv31552/tests
Modified Files:
testZope2FS.py
Log Message:
Added OptionalAspect, a wrapper that disables an aspect if it can't
serialize the object. This involved refactoring the IAspectSerializer
and IObjectSerializer interfaces. Thanks, Christian, for discovering
the need for this.
=== Products/AdaptableStorage/tests/testZope2FS.py 1.10 => 1.11 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.10 Fri Jan 3 17:04:24 2003
+++ Products/AdaptableStorage/tests/testZope2FS.py Mon Jan 6 10:36:51 2003
@@ -24,6 +24,7 @@
from ZODB import Persistent
from Persistence import PersistentMapping
from OFS.Folder import Folder
+from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
from Products.AdaptableStorage.zodb.ASDB import ASDB
@@ -40,6 +41,14 @@
self.title = title
+class TestObjectManager(ObjectManager):
+
+ meta_type = 'Zope2FS Test ObjectManager'
+
+ def __init__(self, title):
+ self.title = title
+
+
class TestFile(SimpleItem):
meta_type = 'Zope2FS Test File'
@@ -167,6 +176,30 @@
ff = app2.Holidays.NewYear
self.assertEqual(ff.title, "New Year's Eve")
self.assertEqual(ff.__class__, TestFolder)
+ finally:
+ conn2.close()
+ finally:
+ conn.close()
+
+
+ def testAnyFolderWithoutPropertiesStorage(self):
+ # Try to store a folderish object that does not implement
+ # PropertyManager (tests OptionalAspect)
+ conn = self.db.open()
+ try:
+ app = conn.root()['Application']
+ f = TestObjectManager("* Holiday Calendar *")
+ f.id = 'Holidays'
+ app._setObject(f.id, f, set_owner=0)
+ get_transaction().commit()
+
+ # Verify the ability to load it
+ conn2 = self.db.open()
+ try:
+ app2 = conn2.root()['Application']
+ ff = app2.Holidays
+ self.assertEqual(ff.title, "* Holiday Calendar *")
+ self.assertEqual(ff.__class__, TestObjectManager)
finally:
conn2.close()
finally: