[Zope-CVS] CVS: Products/AdaptableStorage/tests - Zope2TestBase.py:1.4.2.5 testASStorage.py:1.4.2.5 testAll.py:1.3.2.3 testSerialization.py:1.7.2.3 testZope2FS.py:1.10.2.3

Christian Zagrodnick cz@gocept.com
Tue, 4 Feb 2003 12:30:24 -0500


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

Modified Files:
      Tag: zagy-patches
	Zope2TestBase.py testASStorage.py testAll.py 
	testSerialization.py testZope2FS.py 
Log Message:
merging HEAD into zagy-patches branch

=== Products/AdaptableStorage/tests/Zope2TestBase.py 1.4.2.4 => 1.4.2.5 ===
--- Products/AdaptableStorage/tests/Zope2TestBase.py:1.4.2.4	Mon Feb  3 12:43:19 2003
+++ Products/AdaptableStorage/tests/Zope2TestBase.py	Tue Feb  4 12:29:50 2003
@@ -25,7 +25,10 @@
 from OFS.ObjectManager import ObjectManager
 from OFS.SimpleItem import SimpleItem
 from OFS.Image import manage_addFile
+from OFS.DTMLMethod import DTMLMethod
 from AccessControl.User import User, UserFolder
+from Products.PythonScripts.PythonScript import PythonScript
+from Products.ZSQLMethods.SQL import manage_addZSQLMethod
 
 from Products.AdaptableStorage.patches import applySetObPatch
 
@@ -366,4 +369,77 @@
                 conn2.close()
         finally:
             conn.close()
+
+
+    def testPythonScript(self):
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            script = PythonScript('script')
+            script.write('##title=test script\nreturn "OK"')
+            script._makeFunction()
+            app._setObject(script.id, script, set_owner=0)
+            get_transaction().commit()
+
+            conn2 = self.db.open()
+            try:
+                app = conn2.root()['Application']
+                script = app.script
+                self.assertEqual(script.title, 'test script')
+                res = script()
+                self.assertEqual(res, 'OK')
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+
+
+    def testDTMLMethod(self):
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            m = DTMLMethod()
+            m._setId('m')
+            method_body = '''All <dtml-var expr="'OK'">.'''
+            m.manage_edit(method_body, 'test method')
+            app._setObject(m.getId(), m, set_owner=0)
+            get_transaction().commit()
+
+            conn2 = self.db.open()
+            try:
+                app = conn2.root()['Application']
+                m = app.m
+                self.assertEqual(m.title, 'test method')
+                res = m()
+                self.assertEqual(res, 'All OK.')
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+
+
+    def testZSQLMethod(self):
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            template = 'SELECT <dtml-var foo> from <dtml-var bar>'
+            manage_addZSQLMethod(app, 'm', 'test sql', 'none', 'foo bar',
+                                 template)
+            get_transaction().commit()
+
+            conn2 = self.db.open()
+            try:
+                app = conn2.root()['Application']
+                m = app.m
+                self.assertEqual(m.title, 'test sql')
+                self.assertEqual(m._arg._keys, ['foo', 'bar'])
+                self.assertEqual(m.src, template)
+            finally:
+                conn2.close()
+
+        finally:
+            conn.close()
+
 


=== Products/AdaptableStorage/tests/testASStorage.py 1.4.2.4 => 1.4.2.5 ===


=== Products/AdaptableStorage/tests/testAll.py 1.3.2.2 => 1.3.2.3 ===
--- Products/AdaptableStorage/tests/testAll.py:1.3.2.2	Mon Feb  3 12:43:19 2003
+++ Products/AdaptableStorage/tests/testAll.py	Tue Feb  4 12:29:50 2003
@@ -13,6 +13,11 @@
 ##############################################################################
 """Run all unit tests
 
+To run all tests, invoke this script with the PYTHONPATH environment
+variable set.  Example:
+
+PYTHONPATH=~/cvs/Zope/lib/python python testAll.py
+
 $Id$
 """
 


=== Products/AdaptableStorage/tests/testSerialization.py 1.7.2.2 => 1.7.2.3 ===


=== Products/AdaptableStorage/tests/testZope2FS.py 1.10.2.2 => 1.10.2.3 ===