[Zope3-checkins] CVS: Zope3/src/zope/app/tests - test_decorator.py:1.3.18.1

Marius Gedminas marius at pov.lt
Mon Feb 23 14:18:35 EST 2004


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

Modified Files:
      Tag: mgedmin-events2-branch
	test_decorator.py 
Log Message:
Added interaction to security proxies.  Added interaction arguments to security
checkers.  Added a lot of XXX comments in places where proxies are created but
no interaction is (yet) available.

Added an initial draft of IInteraction to zope.security.interfaces.  This might
move to zope.interaction.interfaces as suggested by Steve.

Fixed a buglet in CheckerLoggingMixin: check_getattr delegated the check to
super(...).check instead of super(...).check_getattr.  Added full unit tests
for CheckerLoggingMixin.



=== Zope3/src/zope/app/tests/test_decorator.py 1.3 => 1.3.18.1 ===
--- Zope3/src/zope/app/tests/test_decorator.py:1.3	Fri Nov 21 12:09:39 2003
+++ Zope3/src/zope/app/tests/test_decorator.py	Mon Feb 23 14:18:04 2004
@@ -34,10 +34,10 @@
     pass
 
 class D1(Decorator):
-  implements(I1)
+    implements(I1)
 
 class D2(Decorator):
-  implements(I2)
+    implements(I2)
 
 
 def check_forbidden_call(callable, *args):
@@ -103,6 +103,7 @@
     >>> defineChecker(Foo, NamesChecker(['a']))
     >>> defineChecker(MyDecorator, NoProxy)
 
+    >>> interaction = object()
     >>> w = MyDecorator(Foo())
     >>> from zope.security.checker import selectChecker
     >>> print selectChecker(w)
@@ -110,11 +111,11 @@
     >>> c = w.__Security_checker__
     >>> print type(c)
     <class 'zope.security.checker.Checker'>
-    >>> c.check_getattr(w, 'a')
+    >>> c.check_getattr(w, 'a', interaction)
 
-    >>> check_forbidden_call(c.check_getattr, w, 'b')
+    >>> check_forbidden_call(c.check_getattr, w, 'b', interaction)
     'ForbiddenAttribute: b'
-    >>> check_forbidden_call(c.check_getattr, w, 'c')
+    >>> check_forbidden_call(c.check_getattr, w, 'c', interaction)
     'ForbiddenAttribute: c'
 
     >>> class MyDecorator2(Decorator):
@@ -124,11 +125,11 @@
     >>> c = w.__Security_checker__
     >>> print type(c)
     <class 'zope.security.checker.CombinedChecker'>
-    >>> c.check_getattr(w, 'a')
+    >>> c.check_getattr(w, 'a', interaction)
 
-    >>> c.check_getattr(w, 'b')
+    >>> c.check_getattr(w, 'b', interaction)
 
-    >>> check_forbidden_call(c.check_getattr, w, 'c')
+    >>> check_forbidden_call(c.check_getattr, w, 'c', interaction)
     'ForbiddenAttribute: c'
 
     >>> w = MyDecorator(None)




More information about the Zope3-Checkins mailing list