[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests - test_permissionfield.py:1.5 test_securitydirectives.py:1.4 test_zopepolicy.py:1.2
R. Sean Bowman
sean.bowman@acm.org
Thu, 6 Feb 2003 01:50:27 -0500
Update of /cvs-repository/Zope3/src/zope/app/security/tests
In directory cvs.zope.org:/tmp/cvs-serv18167/zope/app/security/tests
Modified Files:
test_permissionfield.py test_securitydirectives.py
test_zopepolicy.py
Log Message:
finished changing service names to use strings defined in
zope/component/servicenames.py, changed the name of
ErrorReportingService to ErrorReports and Resources to ResourceService
=== Zope3/src/zope/app/security/tests/test_permissionfield.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/security/tests/test_permissionfield.py:1.4 Tue Jan 21 16:21:47 2003
+++ Zope3/src/zope/app/security/tests/test_permissionfield.py Thu Feb 6 01:49:54 2003
@@ -24,13 +24,15 @@
from zope.app.interfaces.security import IPermissionService
from zope.component.service \
import serviceManager, defineService
+from zope.component.servicenames import Permissions
+
from zope.app.security.registries.permissionregistry import Permission
class TestPermissionField(PlacelessSetup, TestCase):
def test_validate(self):
- defineService("Permissions", IPermissionService)
- serviceManager.provideService("Permissions", permissionRegistry)
+ defineService(Permissions, IPermissionService)
+ serviceManager.provideService(Permissions, permissionRegistry)
dummy = Permission('dummy', 'Dummy', 'Dummy permission')
field = PermissionField()
self.assertRaises(ValidationError, field.validate, dummy)
=== Zope3/src/zope/app/security/tests/test_securitydirectives.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/security/tests/test_securitydirectives.py:1.3 Thu Dec 26 13:49:09 2002
+++ Zope3/src/zope/app/security/tests/test_securitydirectives.py Thu Feb 6 01:49:54 2003
@@ -20,7 +20,7 @@
from StringIO import StringIO
from zope.component.service import serviceManager as services
-
+from zope.component.servicenames import Roles, Permissions, Authentication
from zope.app.interfaces.security import IPermissionService
from zope.app.interfaces.security import IRoleService
from zope.app.interfaces.security import IAuthenticationService
@@ -54,14 +54,14 @@
def setUp(self):
CleanUp.setUp(self)
- services.defineService('Permissions', IPermissionService)
- services.provideService('Permissions', pregistry)
+ services.defineService(Permissions, IPermissionService)
+ services.provideService(Permissions, pregistry)
- services.defineService('Roles', IRoleService)
- services.provideService('Roles', rregistry)
+ services.defineService(Roles, IRoleService)
+ services.provideService(Roles, rregistry)
- services.defineService('Authentication', IAuthenticationService)
- services.provideService('Authentication', principalRegistry)
+ services.defineService(Authentication, IAuthenticationService)
+ services.provideService(Authentication, principalRegistry)
class TestPrincipalDirective(CleanUp, unittest.TestCase):
=== Zope3/src/zope/app/security/tests/test_zopepolicy.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/security/tests/test_zopepolicy.py:1.1 Mon Dec 30 22:35:12 2002
+++ Zope3/src/zope/app/security/tests/test_zopepolicy.py Thu Feb 6 01:49:54 2003
@@ -27,6 +27,8 @@
from zope.proxy.context import ContextWrapper
from zope.component import getService
+from zope.component.servicenames import Roles, Permissions, Adapters
+from zope.component.servicenames import Authentication
from zope.app.interfaces.security import IRolePermissionManager
from zope.app.security.registries.permissionregistry import permissionRegistry
from zope.app.security.registries.principalregistry import principalRegistry
@@ -76,18 +78,18 @@
PlacefulSetup.setUp(self)
- services.defineService('Permissions', IPermissionService)
- services.provideService('Permissions', permissionRegistry)
+ services.defineService(Permissions, IPermissionService)
+ services.provideService(Permissions, permissionRegistry)
- services.defineService('Roles', IRoleService)
- services.provideService('Roles', roleRegistry)
+ services.defineService(Roles, IRoleService)
+ services.provideService(Roles, roleRegistry)
- services.defineService('Authentication', IAuthenticationService)
- services.provideService('Authentication', principalRegistry)
+ services.defineService(Authentication, IAuthenticationService)
+ services.provideService(Authentication, principalRegistry)
- getService(None,"Adapters").provideAdapter(
+ getService(None,Adapters).provideAdapter(
IAttributeAnnotatable, IAnnotations,
AttributeAnnotations)
@@ -195,14 +197,14 @@
def testUserWithRoles(self):
- services.provideService('Authentication', AuthService(),force=True)
+ services.provideService(Authentication, AuthService(),force=True)
self.failUnless(
self.policy.checkPermission(self.write, None, Context(self.jim)))
self.__assertPermissions(self.jim, ['create', 'read', 'write'])
def testPlayfulPrincipalRole(self):
- getService(None,"Adapters").provideAdapter(
+ getService(None,Adapters).provideAdapter(
ITest,
IPrincipalRoleManager, AnnotationPrincipalRoleManager)
@@ -221,7 +223,7 @@
def testPlayfulRolePermissions(self):
ARPM = AnnotationRolePermissionManager
- getService(None,"Adapters").provideAdapter(ITest,
+ getService(None,Adapters).provideAdapter(ITest,
IRolePermissionManager, ARPM)
test = permissionRegistry.definePermission('test', 'Test', '')
test = test.getId()
@@ -278,7 +280,7 @@
def testPlayfulPrinciplePermissions(self):
APPM = AnnotationPrincipalPermissionManager
- getService(None,"Adapters").provideAdapter(ITest,
+ getService(None,Adapters).provideAdapter(ITest,
IPrincipalPermissionManager, APPM)
ob1 = TestClass()