[Zope-CVS] CVS: Products/AdaptableStorage/gateway_sql/tests - testZope2SQL.py:1.4

Shane Hathaway shane@zope.com
Fri, 3 Jan 2003 17:04:53 -0500


Update of /cvs-repository/Products/AdaptableStorage/gateway_sql/tests
In directory cvs.zope.org:/tmp/cvs-serv20380/gateway_sql/tests

Modified Files:
	testZope2SQL.py 
Log Message:
Added PropertyManager support.


=== Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py:1.3	Mon Dec 23 23:29:32 2002
+++ Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py	Fri Jan  3 17:04:20 2003
@@ -173,6 +173,44 @@
             conn.close()
 
 
+    def testStoreProperties(self):
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            f = Folder()
+            f.id = 'Holidays'
+            f.title = 'Holiday Calendar'
+            app._setObject(f.id, f, set_owner=0)
+            get_transaction().commit()
+
+            f._setProperty('pi', 3.14, 'float')
+            f._setProperty('stuff', ['a', 'bc', 'd'], 'lines')
+            get_transaction().commit()
+
+            conn2 = self.db.open()
+            try:
+                app = conn2.root()['Application']
+                self.assert_(hasattr(app, 'Holidays'))
+                got = 0
+                for k, v in app.Holidays.propertyItems():
+                    if k == 'title':
+                        got += 1
+                        self.assertEqual(v, 'Holiday Calendar')
+                    elif k == 'pi':
+                        got += 1
+                        self.assertEqual(v, 3.14)
+                    elif k == 'stuff':
+                        got += 1
+                        self.assertEqual(v, ['a', 'bc', 'd'])
+                self.assertEqual(got, 3)
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+            
+
+
 if __name__ == '__main__':
     unittest.main()