[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate/tests - testusage.pt:1.2 test_viewzpt.py:1.5

Godefroid Chapelle gotcha@swing.be
Tue, 25 Mar 2003 06:23:39 -0500


Update of /cvs-repository/Zope3/src/zope/app/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv20400/app/pagetemplate/tests

Modified Files:
	test_viewzpt.py 
Added Files:
	testusage.pt 
Log Message:
merging template_usage branch

connection to menu usage still to be done



=== Zope3/src/zope/app/pagetemplate/tests/testusage.pt 1.1 => 1.2 ===
--- /dev/null	Tue Mar 25 06:23:39 2003
+++ Zope3/src/zope/app/pagetemplate/tests/testusage.pt	Tue Mar 25 06:23:08 2003
@@ -0,0 +1 @@
+<html><body><tal:usage replace="usage" /></body></html>


=== Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py:1.4	Tue Feb 11 21:17:24 2003
+++ Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py	Tue Mar 25 06:23:08 2003
@@ -90,8 +90,31 @@
         self.failUnless(the_view is views[the_view_name])
 
 
+class TestViewZPTUsage(PlacefulSetup, unittest.TestCase):
+
+    def setUp(self):
+        PlacefulSetup.setUp(self)
+        self.context = C1()
+        self.context.request = None
+
+    def checkInitWithUsage(self):
+        self.t = ViewPageTemplateFile('testusage.pt', usage="test")
+        result = self.t(self.context)
+        self.assertEquals(result, "<html><body>test</body></html>")
+        result = self.t(self.context, template_usage="other")
+        self.assertEquals(result, "<html><body>other</body></html>")
+
+    def checkInitWithoutUsage(self):
+        self.t = ViewPageTemplateFile('testusage.pt')
+        result = self.t(self.context)
+        self.assertEquals(result, "<html><body></body></html>")
+        result = self.t(self.context, template_usage="other")
+        self.assertEquals(result, "<html><body>other</body></html>")
+
+
 def test_suite():
     return unittest.makeSuite(TestViewZPT, 'check')
+    return unittest.makeSuite(TestViewZPTUsage, 'check')
 
 if __name__ == '__main__':
     unittest.TextTestRunner().run(test_suite())