[Zope-CVS] CVS: Products/AdaptableStorage/tests - Zope2TestBase.py:1.8 testZope2FS.py:1.20

Shane Hathaway shane@zope.com
Thu, 6 Feb 2003 13:39:23 -0500


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

Modified Files:
	Zope2TestBase.py testZope2FS.py 
Log Message:
Added tests of page templates

=== Products/AdaptableStorage/tests/Zope2TestBase.py 1.7 => 1.8 ===
--- Products/AdaptableStorage/tests/Zope2TestBase.py:1.7	Mon Feb  3 13:26:52 2003
+++ Products/AdaptableStorage/tests/Zope2TestBase.py	Thu Feb  6 13:39:22 2003
@@ -29,6 +29,7 @@
 from AccessControl.User import User, UserFolder
 from Products.PythonScripts.PythonScript import PythonScript
 from Products.ZSQLMethods.SQL import manage_addZSQLMethod
+from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 
 from Products.AdaptableStorage.patches import applySetObPatch
 
@@ -367,6 +368,28 @@
                 self.assertEqual(str(app.file), data)
             finally:
                 conn2.close()
+        finally:
+            conn.close()
+
+
+    def testPageTemplate(self):
+        text = '<span tal:content="string:Hello">example</span>'
+        expected = '<span>Hello</span>'
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            template = ZopePageTemplate('template', text)
+            app._setObject(template.id, template, set_owner=0)
+            get_transaction().commit()
+
+            conn2 = self.db.open()
+            try:
+                app = conn2.root()['Application']
+                res = app.template()
+                self.assertEqual(res.strip(), expected)
+            finally:
+                conn2.close()
+
         finally:
             conn.close()
 


=== Products/AdaptableStorage/tests/testZope2FS.py 1.19 => 1.20 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.19	Thu Feb  6 13:14:13 2003
+++ Products/AdaptableStorage/tests/testZope2FS.py	Thu Feb  6 13:39:22 2003
@@ -31,6 +31,7 @@
 from Products.AdaptableStorage.zodb.ASStorage import ASStorage
 from Products.AdaptableStorage.zodb.StaticResource import StaticResource
 from Products.AdaptableStorage.Zope2FS import createMapper
+from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 
 from Zope2TestBase import Zope2TestBase, Folder
 
@@ -133,6 +134,23 @@
             f.id = 'Holidays'
             app._setObject(f.id, f, set_owner=0)
             get_transaction().commit()
+        finally:
+            conn.close()
+
+
+    def testAutomaticPageTemplateExtension(self):
+        text = '<span tal:content="string:Hello">example</span>'
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            template = ZopePageTemplate('template', text)
+            app._setObject(template.id, template, set_owner=0)
+            get_transaction().commit()
+
+            dir = self.conn.expandPath('/')
+            names = os.listdir(dir)
+            self.assert_('template.html' in names, names)
+            self.assert_('template' not in names, names)
         finally:
             conn.close()