[Zope-Checkins] SVN: Products.Five/branches/1.4/browser/tests/ Also test for a permission that anonymous doesn't have.

Philipp von Weitershausen philikon at philikon.de
Mon Jan 8 11:01:59 EST 2007


Log message for revision 71813:
  Also test for a permission that anonymous doesn't have.
  

Changed:
  U   Products.Five/branches/1.4/browser/tests/test_zope3security.py
  U   Products.Five/branches/1.4/browser/tests/zope3security.py

-=-
Modified: Products.Five/branches/1.4/browser/tests/test_zope3security.py
===================================================================
--- Products.Five/branches/1.4/browser/tests/test_zope3security.py	2007-01-08 15:43:25 UTC (rev 71812)
+++ Products.Five/branches/1.4/browser/tests/test_zope3security.py	2007-01-08 16:01:59 UTC (rev 71813)
@@ -40,9 +40,12 @@
 
       >>> from Products.Five.testbrowser import Browser
       >>> browser = Browser()
-      >>> browser.open('http://localhost/test_folder_1_/testoid/@@zope3security.html')
+      >>> browser.open('http://localhost/test_folder_1_/testoid/@@zope3security.html?permission=zope2.View')
       >>> print browser.contents
-      Yes, you have the zope2.View permission.
+      Yes, you have the 'zope2.View' permission.
+      >>> browser.open('http://localhost/test_folder_1_/testoid/@@zope3security.html?permission=zope2.DeleteObjects')
+      >>> print browser.contents
+      No, you don't have the 'zope2.DeleteObjects' permission.
 
     Clean up:
 

Modified: Products.Five/branches/1.4/browser/tests/zope3security.py
===================================================================
--- Products.Five/branches/1.4/browser/tests/zope3security.py	2007-01-08 15:43:25 UTC (rev 71812)
+++ Products.Five/branches/1.4/browser/tests/zope3security.py	2007-01-08 16:01:59 UTC (rev 71813)
@@ -3,8 +3,8 @@
 
 class Zope3SecurityView(BrowserView):
 
-    def __call__(self):
-        if checkPermission('zope2.View', self.context):
-            return "Yes, you have the zope2.View permission."
+    def __call__(self, permission):
+        if checkPermission(permission, self.context):
+            return "Yes, you have the %r permission." % permission
         else:
-            return "No, you don't have the zope2.View permission."
+            return "No, you don't have the %r permission." % permission



More information about the Zope-Checkins mailing list