[Zope-CVS] CVS: Products/AdaptableStorage/tests - Zope2TestBase.py:1.6

Shane Hathaway shane@zope.com
Tue, 21 Jan 2003 11:49:47 -0500


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

Modified Files:
	Zope2TestBase.py 
Log Message:
Fixed storage of selection properties.  The select_variable was being forgotten.

=== Products/AdaptableStorage/tests/Zope2TestBase.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/tests/Zope2TestBase.py:1.5	Tue Jan 14 12:46:31 2003
+++ Products/AdaptableStorage/tests/Zope2TestBase.py	Tue Jan 21 11:49:45 2003
@@ -219,6 +219,48 @@
             conn.close()
 
 
+    def testStoreSelectionProperties(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('choices', ['alpha', 'omega', 'delta'], 'lines')
+            f._setProperty('greek', 'choices', 'multiple selection')
+            f._setProperty('hebrew', 'choices', 'selection')
+            f.greek = ['alpha', 'omega']
+            f.hebrew = 'alpha'
+            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 == 'greek':
+                        got += 1
+                        self.assertEqual(v, ['alpha', 'omega'])
+                    if k == 'hebrew':
+                        got += 1
+                        self.assertEqual(v, 'alpha')
+                self.assertEqual(got, 2)
+                # Be sure the select_variable got restored.
+                dict = app.Holidays.propdict()
+                self.assertEqual(dict['greek']['select_variable'], 'choices')
+                self.assertEqual(dict['hebrew']['select_variable'], 'choices')
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+
+
+
     def testStoreUserFolder(self):
         conn = self.db.open()
         try: