[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - zope2testbase.py:1.4

Shane Hathaway shane@zope.com
Wed, 11 Jun 2003 09:59:24 -0400


Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv25244/tests

Modified Files:
	zope2testbase.py 
Log Message:
Ape was not restoring boolean properties correctly.  Good catch by Stefan Planert.

=== Products/Ape/lib/apelib/tests/zope2testbase.py 1.3 => 1.4 ===
--- Products/Ape/lib/apelib/tests/zope2testbase.py:1.3	Sat Apr 12 16:53:28 2003
+++ Products/Ape/lib/apelib/tests/zope2testbase.py	Wed Jun 11 09:58:53 2003
@@ -269,6 +269,50 @@
 
 
 
+    def testStorePropertyTypes(self):
+        # Test that Ape restores properties to the correct types.
+        from DateTime import DateTime
+        now = DateTime()
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            f = Folder()
+            f.id = 'Holidays'
+            app._setObject(f.id, f, set_owner=0)
+            get_transaction().commit()
+
+            f._setProperty('string1', 's', 'string')
+            f._setProperty('float1', 3.14, 'float')
+            f._setProperty('int1', 5, 'int')
+            f._setProperty('long1', 2L**33, 'long')
+            f._setProperty('date1', now, 'date')
+            f._setProperty('date2', now, 'date_international')
+            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, now)
+                self.assertEqual(f.date2, now)
+                self.assertEqual(f.text1, 'abc\ndef')
+                self.assertEqual(f.boolean0, 0)
+                self.assertEqual(f.boolean1, 1)
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+
+
     def testStoreUserFolder(self):
         conn = self.db.open()
         try: