[z3-checkins] r9820 - in z3/Five/branch/zope28-integration/tests: . products/FiveTest

efge at codespeak.net efge at codespeak.net
Wed Mar 16 13:00:59 MET 2005


Author: efge
Date: Wed Mar 16 13:00:59 2005
New Revision: 9820

Added:
   z3/Five/branch/zope28-integration/tests/products/FiveTest/security.pt   (contents, props changed)
Modified:
   z3/Five/branch/zope28-integration/tests/products/FiveTest/configure.zcml
   z3/Five/branch/zope28-integration/tests/test_five.py
Log:
Test that templates are unrestricted.

Modified: z3/Five/branch/zope28-integration/tests/products/FiveTest/configure.zcml
==============================================================================
--- z3/Five/branch/zope28-integration/tests/products/FiveTest/configure.zcml	(original)
+++ z3/Five/branch/zope28-integration/tests/products/FiveTest/configure.zcml	Wed Mar 16 13:00:59 2005
@@ -191,6 +191,15 @@
       permission="zope2.ViewManagementScreens"
       />
 
+  <!-- template security -->
+
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      template="security.pt"
+      name="security.html"
+      permission="zope2.View"
+      />
+
   <!-- macro page -->
   <browser:page
       for=".interfaces.ISimpleContent"

Added: z3/Five/branch/zope28-integration/tests/products/FiveTest/security.pt
==============================================================================
--- (empty file)
+++ z3/Five/branch/zope28-integration/tests/products/FiveTest/security.pt	Wed Mar 16 13:00:59 2005
@@ -0,0 +1,5 @@
+<div tal:define="comment string:Testing unrestricted code"
+      tal:content="python:None.__class__.__name__" />
+<div tal:define="comment string:Testing unrestricted modules access;
+                 smtpd nocall:modules/smtpd"
+      tal:content="python:smtpd.__name__" />

Modified: z3/Five/branch/zope28-integration/tests/test_five.py
==============================================================================
--- z3/Five/branch/zope28-integration/tests/test_five.py	(original)
+++ z3/Five/branch/zope28-integration/tests/test_five.py	Wed Mar 16 13:00:59 2005
@@ -175,6 +175,16 @@
 """
         self.assertEquals(expected, view())
 
+    def test_zpt_security(self):
+        self.logout()
+        view = self.folder.unrestrictedTraverse('testoid/security.html')
+        expected = """\
+<div>NoneType</div>
+<div>smtpd</div>
+"""
+        self.assertEquals(expected, view())
+
+
     def test_template_resource(self):
         resource = self.folder.unrestrictedTraverse('testoid/++resource++cockatiel.html')
         self.assert_(isinstance(resource, Resource))


More information about the z3-checkins mailing list