[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - testzope2fs.py:1.10
testzope2sql.py:1.12 zope2testbase.py:1.13
Shane Hathaway
shane at zope.com
Wed Mar 24 23:28:53 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv10156/lib/apelib/tests
Modified Files:
testzope2fs.py testzope2sql.py zope2testbase.py
Log Message:
Fixed boolean properties of fixed schemas.
Storing a boolean as "yes" vs. "" doesn't work in an integer column.
=== Products/Ape/lib/apelib/tests/testzope2fs.py 1.9 => 1.10 ===
--- Products/Ape/lib/apelib/tests/testzope2fs.py:1.9 Sat Mar 20 01:34:24 2004
+++ Products/Ape/lib/apelib/tests/testzope2fs.py Wed Mar 24 23:28:23 2004
@@ -35,7 +35,7 @@
from apelib.zope2.mapper import load_conf
from apelib.fs.interfaces import FSWriteError
from apelib.fs.connection import FSConnection
-from zope2testbase import Zope2TestBase, Folder
+from apelib.tests.zope2testbase import Zope2TestBase, Folder
try:
=== Products/Ape/lib/apelib/tests/testzope2sql.py 1.11 => 1.12 ===
--- Products/Ape/lib/apelib/tests/testzope2sql.py:1.11 Wed Mar 24 10:52:08 2004
+++ Products/Ape/lib/apelib/tests/testzope2sql.py Wed Mar 24 23:28:23 2004
@@ -24,7 +24,7 @@
from apelib.zodb3.storage import ApeStorage
from apelib.zodb3.resource import StaticResource
from apelib.zope2.mapper import load_conf
-from zope2testbase import Zope2TestBase
+from apelib.tests.zope2testbase import Zope2TestBase
conf = None
=== Products/Ape/lib/apelib/tests/zope2testbase.py 1.12 => 1.13 ===
--- Products/Ape/lib/apelib/tests/zope2testbase.py:1.12 Sat Mar 20 01:34:24 2004
+++ Products/Ape/lib/apelib/tests/zope2testbase.py Wed Mar 24 23:28:23 2004
@@ -61,6 +61,14 @@
self.content = content
+class FixedSchemaTestFolder(Folder):
+
+ _properties = (
+ {'id': 'mytitle', 'type': 'string', 'mode': 'w'},
+ {'id': 'myflag', 'type': 'boolean', 'mode': 'w'},
+ )
+
+
class Zope2TestBase:
def test_load(self):
@@ -296,28 +304,55 @@
f._setProperty('text1', 'abc\ndef', 'text')
f._setProperty('boolean0', 0, 'boolean')
f._setProperty('boolean1', 1, 'boolean')
- f = None
get_transaction().commit()
conn2 = self.db.open()
try:
- app = conn2.root()['Application']
- f = app.Holidays
- self.assertEqual(f.string1, 's')
- self.assertEqual(f.float1, 3.14)
- self.assertEqual(f.int1, 5)
- self.assertEqual(f.long1, 2L**33)
- self.assertEqual(f.date1.ISO(), now.ISO())
+ app2 = conn2.root()['Application']
+ f2 = app2.Holidays
+ self.assertEqual(f2.string1, 's')
+ self.assertEqual(f2.float1, 3.14)
+ self.assertEqual(f2.int1, 5)
+ self.assertEqual(f2.long1, 2L**33)
+ self.assertEqual(f2.date1.ISO(), now.ISO())
if INTL_DATES:
- self.assertEqual(f.date2.ISO(), now.ISO())
- self.assertEqual(f.text1, 'abc\ndef')
- self.assertEqual(f.boolean0, 0)
- self.assertEqual(f.boolean1, 1)
+ self.assertEqual(f2.date2.ISO(), now.ISO())
+ self.assertEqual(f2.text1, 'abc\ndef')
+ self.assertEqual(f2.boolean0, 0)
+ self.assertEqual(f2.boolean1, 1)
+ finally:
+ conn2.close()
+
+ finally:
+ conn.close()
+
+
+ def test_store_fixed_schema(self):
+ # Test that Ape restores properties of fixed schemas correctly
+ conn = self.db.open()
+ try:
+ app = conn.root()['Application']
+ f = FixedSchemaTestFolder()
+ f.id = 'Holidays'
+ f.mytitle = 'bah humbug'
+ f.myflag = 1
+ app._setObject(f.id, f, set_owner=0)
+ get_transaction().commit()
+ f.myflag = 0
+ get_transaction().commit()
+
+ conn2 = self.db.open()
+ try:
+ app2 = conn2.root()['Application']
+ f2 = app2.Holidays
+ self.assertEqual(f2.mytitle, 'bah humbug')
+ self.assertEqual(f2.myflag, 0)
finally:
conn2.close()
finally:
conn.close()
+
def test_store_user_folder(self):
More information about the Zope-CVS
mailing list