[z3-checkins] r11421 - z3/Five/trunk/tests

jw at codespeak.net jw at codespeak.net
Mon Apr 25 15:49:23 CEST 2005


Author: jw
Date: Mon Apr 25 15:49:23 2005
New Revision: 11421

Modified:
   z3/Five/trunk/tests/test_five.py
Log:
Expose a bug in PageTemplateResources:

Publishing a resource would fail with a IndexError "tuple index out of range"
in Zope-2's BaseRequest code that calls the __browser_default__ on the
resource instance.

The __browser_default__ method returns an empty tuple wher I guess it should
return the name of the method to call on the resource instance to make it
render the template.



Modified: z3/Five/trunk/tests/test_five.py
==============================================================================
--- z3/Five/trunk/tests/test_five.py	(original)
+++ z3/Five/trunk/tests/test_five.py	Mon Apr 25 15:49:23 2005
@@ -185,10 +185,7 @@
     def test_template_resource(self):
         resource = self.folder.unrestrictedTraverse('testoid/++resource++cockatiel.html')
         self.assert_(isinstance(resource, Resource))
-        expected = """\
-<p>Have you ever seen a cockatiel?</p>
-<p>maybe</p>
-"""
+        expected = 'http://nohost/test_folder_1_/testoid/++resource++cockatiel.html'
         self.assertEquals(expected, resource())
 
     def test_file_resource(self):
@@ -331,6 +328,11 @@
         response = self.publish(url, basic='manager:r00t')
         self.assertEquals(200, response.getStatus())
 
+    def test_publish_template_resource(self):
+        url = '/test_folder_1_/testoid/++resource++cockatiel.html'
+        response = self.publish(url, basic='manager:r00t')
+        self.assertEquals(200, response.getStatus())
+        
     # Disabled __call__ overriding for now. Causes more trouble
     # than it fixes.
     # def test_existing_call(self):


More information about the z3-checkins mailing list