[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests - test_ftpauth.py:1.1.24.1 test_protectclass.py:1.3.10.1 test_securitydirectives.py:1.7.16.1 test_zopepolicy.py:1.9.10.1

Grégoire Weber zope@i-con.ch
Sun, 22 Jun 2003 10:23:56 -0400


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

Modified Files:
      Tag: cw-mail-branch
	test_ftpauth.py test_protectclass.py 
	test_securitydirectives.py test_zopepolicy.py 
Log Message:
Synced up with HEAD

=== Zope3/src/zope/app/security/tests/test_ftpauth.py 1.1 => 1.1.24.1 ===
--- Zope3/src/zope/app/security/tests/test_ftpauth.py:1.1	Mon Feb  3 10:08:46 2003
+++ Zope3/src/zope/app/security/tests/test_ftpauth.py	Sun Jun 22 10:23:26 2003
@@ -18,11 +18,12 @@
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.publisher.interfaces.ftp import IFTPCredentials
 from zope.app.security.ftpauth import FTPAuth
+from zope.interface import implements
 
 class FTPCredentials:
     __doc__ = IFTPCredentials.__doc__
 
-    __implements__ =  IFTPCredentials
+    implements(IFTPCredentials)
 
     def __init__(self, credentials):
         self.credentials = credentials


=== Zope3/src/zope/app/security/tests/test_protectclass.py 1.3 => 1.3.10.1 ===
--- Zope3/src/zope/app/security/tests/test_protectclass.py:1.3	Thu May  1 15:35:34 2003
+++ Zope3/src/zope/app/security/tests/test_protectclass.py	Sun Jun 22 10:23:26 2003
@@ -20,6 +20,7 @@
 from zope.testing.cleanup import CleanUp # Base class w registry cleanup
 from zope.app.security.protectclass import protectName, protectLikeUnto
 from zope.app.security.protectclass import protectSetAttribute
+from zope.interface import implements
 
 NOTSET = []
 
@@ -38,7 +39,7 @@
             def m2(self):
                 return "m2"
         class C(B):
-            __implements__ = I
+            implements(I)
             def m3(self):
                 return "m3"
             def m4(self):


=== Zope3/src/zope/app/security/tests/test_securitydirectives.py 1.7 => 1.7.16.1 ===
--- Zope3/src/zope/app/security/tests/test_securitydirectives.py:1.7	Thu Mar 13 13:49:09 2003
+++ Zope3/src/zope/app/security/tests/test_securitydirectives.py	Sun Jun 22 10:23:26 2003
@@ -31,7 +31,7 @@
 from zope.testing.cleanup import CleanUp # Base class w registry cleanup
 
 import zope.app.security
-from zope.app.security.settings import Allow, Deny
+from zope.app.security.settings import Allow
 from zope.app.security.registries.principalregistry import principalRegistry
 from zope.app.security.registries.permissionregistry \
         import permissionRegistry as pregistry


=== Zope3/src/zope/app/security/tests/test_zopepolicy.py 1.9 => 1.9.10.1 ===
--- Zope3/src/zope/app/security/tests/test_zopepolicy.py:1.9	Thu May  1 15:35:34 2003
+++ Zope3/src/zope/app/security/tests/test_zopepolicy.py	Sun Jun 22 10:23:26 2003
@@ -20,12 +20,13 @@
 import unittest
 
 from zope.component.service import serviceManager as services
+from zope.interface import implements
 
 from zope.app.interfaces.security import IPermissionService
 from zope.app.interfaces.security import IRoleService
 from zope.app.interfaces.security import IAuthenticationService
 
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
 from zope.component import getService
 from zope.app.services.servicenames import Roles, Permissions, Adapters
 from zope.app.services.servicenames import Authentication
@@ -49,8 +50,7 @@
 from zope.app.interfaces.annotation import IAttributeAnnotatable
 from zope.app.interfaces.annotation import IAnnotations
 from zope.app.attributeannotations import AttributeAnnotations
-from zope.app.services.tests.placefulsetup\
-           import PlacefulSetup
+from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.app.security.zopepolicy import permissionsOfPrincipal
 
 class Context:
@@ -61,7 +61,7 @@
     pass
 
 class Principal(PrincipalBase):
-    def getRoles(self): return ['Manager']
+    pass
 
 
 class Test(PlacefulSetup, unittest.TestCase):
@@ -133,7 +133,8 @@
 
         # ... and assign roles to principals
         principalRoleManager.assignRoleToPrincipal(self.peon, self.jim.getId())
-        principalRoleManager.assignRoleToPrincipal(self.manager, self.tim.getId())
+        principalRoleManager.assignRoleToPrincipal(self.manager,
+                                                   self.tim.getId())
 
         self.policy = self._makePolicy()
 
@@ -186,14 +187,6 @@
 
         self.__assertPermissions(self.jim, ['create', 'read', 'write'])
 
-
-    def testUserWithRoles(self):
-        jim = Principal('jim','Jim','Jim Fulton')
-        self.failUnless(
-            self.policy.checkPermission(self.write, None, Context(jim)))
-        self.__assertPermissions(jim, ['create', 'read', 'write'])
-
-
     def testPlayfulPrincipalRole(self):
         getService(None,Adapters).provideAdapter(
             ITest,
@@ -321,7 +314,7 @@
     pass
 
 class TestClass:
-    __implements__ = ITest
+    implements(ITest)
 
     def __init__(self):
         self._roles       = { 'test' : {} }