[Zope3-checkins] CVS: Zope3/src/zope/products/securitypolicy/tests - test_rolecontents.py:1.2.12.1 test_zopepolicy.py:1.2.12.2

Marius Gedminas marius at pov.lt
Fri Mar 19 13:51:24 EST 2004


Update of /cvs-repository/Zope3/src/zope/products/securitypolicy/tests
In directory cvs.zope.org:/tmp/cvs-serv26650/src/zope/products/securitypolicy/tests

Modified Files:
      Tag: mgedmin-events2-branch
	test_rolecontents.py test_zopepolicy.py 
Log Message:
Added IParticipation and replaced the lists of principals in IInteraction with
a list of participations.  Made BaseRequest an IParticipation and replaced
request.user with request.principal everywhere.



=== Zope3/src/zope/products/securitypolicy/tests/test_rolecontents.py 1.2 => 1.2.12.1 ===
--- Zope3/src/zope/products/securitypolicy/tests/test_rolecontents.py:1.2	Wed Jan 14 17:55:35 2004
+++ Zope3/src/zope/products/securitypolicy/tests/test_rolecontents.py	Fri Mar 19 13:50:53 2004
@@ -42,7 +42,7 @@
     def _TestView__newView(self, container):
         from zope.publisher.browser import TestRequest
         request = TestRequest()
-        request.setUser(Principal())
+        request.setPrincipal(Principal())
         return Contents(container, request)
 
 def test_suite():


=== Zope3/src/zope/products/securitypolicy/tests/test_zopepolicy.py 1.2.12.1 => 1.2.12.2 ===
--- Zope3/src/zope/products/securitypolicy/tests/test_zopepolicy.py:1.2.12.1	Mon Mar  8 13:43:43 2004
+++ Zope3/src/zope/products/securitypolicy/tests/test_zopepolicy.py	Fri Mar 19 13:50:53 2004
@@ -53,13 +53,14 @@
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.products.securitypolicy.zopepolicy import permissionsOfPrincipal
 
-class Interaction:
-    def __init__(self, user):
-        self.principals = [user]
-
 class RequestStub:
+    def __init__(self, principal, interaction=None):
+        self.principal = principal
+        self.interaction = interaction
+
+class Interaction:
     def __init__(self, user):
-        self.user = user
+        self.participations = [RequestStub(user, self)]
 
 class Unprotected:
     pass
@@ -162,12 +163,13 @@
         from zope.products.securitypolicy.zopepolicy import ZopeSecurityPolicy
         i1 = ZopeSecurityPolicy().createInteraction(None)
         verifyObject(IInteraction, i1)
-        self.assertEquals(list(i1.principals), [])
+        self.assertEquals(list(i1.participations), [])
 
         user = object()
-        i2 = ZopeSecurityPolicy().createInteraction(RequestStub(user))
+        rq = RequestStub(user)
+        i2 = ZopeSecurityPolicy().createInteraction(rq)
         verifyObject(IInteraction, i2)
-        self.assertEquals(list(i2.principals), [user])
+        self.assertEquals(list(i2.participations), [rq])
 
     def testGlobalCheckPermission(self):
         self.failUnless(self.policy.checkPermission(self.read, None,




More information about the Zope3-Checkins mailing list