[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testProtectClass.py:1.1.2.4 testPublicClass.py:1.1.2.5 testSecurityDirectives.py:1.1.2.7
Jim Fulton
jim@zope.com
Thu, 3 Jan 2002 16:44:44 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv18644/App/Security/tests
Modified Files:
Tag: Zope-3x-branch
testProtectClass.py testPublicClass.py
testSecurityDirectives.py
Log Message:
Changed permission, role, and principal attributes in directives
to permission_id, role_id, and principal_id because they name ids,
not instances.
=== Zope3/lib/python/Zope/App/Security/tests/testProtectClass.py 1.1.2.3 => 1.1.2.4 ===
def testClass(self):
declaration = ("""<security:protectClass
- name="%s" permission="%s" />"""
+ name="%s" permission_id="%s" />"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
instP=P1)
@@ -96,21 +96,22 @@
def testSimpleMethod(self):
declaration = ("""<security:protectClass
- name="%s" permission="%s" method="m1" />"""
+ name="%s" permission_id="%s" method="m1" />"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
instP=P1, m1P=P1)
def testSimpleMethodsPlural(self):
declaration = ("""<security:protectClass
- name="%s" permission="%s" methods="m1, m3" />"""
+ name="%s" permission_id="%s"
+ methods="m1, m3" />"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
instP=P1, m1P=P1, m3P=P1)
def testSimpleInterface(self):
declaration = ("""<security:protectClass
- name="%s" permission="%s" interface="%s" />"""
+ name="%s" permission_id="%s" interface="%s" />"""
% (PREFIX+"test_class", P1, PREFIX+"I"))
# m1 and m2 are in the interface, so should be set, and m3 should not:
self.assertDeclaration(declaration,
@@ -131,7 +132,8 @@
declaration)
# Permission not in top tag and in one subtag but not in the other:
declaration = ("""<security:protectClass name="%s">
- <security:protect permission="%s" method="m1"/>
+ <security:protect permission_id="%s"
+ method="m1"/>
<security:instances/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -140,7 +142,7 @@
declaration)
def testCompositeMethodTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission="%s">
+ declaration = ("""<security:protectClass name="%s" permission_id="%s">
<security:protect method="m1"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -149,14 +151,14 @@
def testCompositeMethodElementPerm(self):
declaration = ("""<security:protectClass name="%s">
- <security:protect permission="%s" method="m1"/>
+ <security:protect permission_id="%s" method="m1"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
m1P=P1)
def testCompositeMethodsPluralTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission="%s">
+ declaration = ("""<security:protectClass name="%s" permission_id="%s">
<security:protect methods="m1, m2"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -165,7 +167,7 @@
def testCompositeMethodsPluralElementPerm(self):
declaration = ("""<security:protectClass name="%s">
- <security:protect permission="%s"
+ <security:protect permission_id="%s"
methods="m1, m3"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -173,7 +175,7 @@
m1P=P1, m3P=P1)
def testCompositeInterfaceTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission="%s">
+ declaration = ("""<security:protectClass name="%s" permission_id="%s">
<security:protect interface="%s"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1, PREFIX+"I"))
@@ -182,14 +184,15 @@
def testCompositeInterfaceElementPerm(self):
declaration = ("""<security:protectClass name="%s">
- <security:protect permission="%s" interface="%s"/>
+ <security:protect permission_id="%s"
+ interface="%s"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1, PREFIX+"I"))
self.assertDeclaration(declaration,
m1P=P1, m2P=P1)
def testCompositeInstancesTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission="%s">
+ declaration = ("""<security:protectClass name="%s" permission_id="%s">
<security:instances/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -198,7 +201,7 @@
def testCompositeInstancesElementPerm(self):
declaration = ("""<security:protectClass name="%s">
- <security:instances permission="%s"/>
+ <security:instances permission_id="%s"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
=== Zope3/lib/python/Zope/App/Security/tests/testPublicClass.py 1.1.2.4 => 1.1.2.5 ===
declaration = (template_bracket
% """<security:publicClass name="%s"
- permission="X"/>""")
+ permission_id="X"/>""")
self.assertRaises(ZopeXMLConfigurationError,
self.assertDeclaration,
declaration)
=== Zope3/lib/python/Zope/App/Security/tests/testSecurityDirectives.py 1.1.2.6 => 1.1.2.7 ===
def testRegister(self):
- f = configfile("""<security:principal principal="1"
+ f = configfile("""<security:principal principal_id="1"
title="Sir Tim Peters"
description="Tim Peters"
login="tim" password="123" />
- <security:principal principal="2"
+ <security:principal principal_id="2"
title="Sir Jim Fulton"
description="Jim Fulton"
login="jim" password="123" />""")
@@ -138,7 +138,7 @@
def testRegister(self):
f = configfile("""
<security:definePermission
- permission="Can Do It"
+ permission_id="Can Do It"
title="A Permissive Permission"
description="This permission lets you do anything" />""")
@@ -153,12 +153,12 @@
def testDuplicationRegistration(self):
f = configfile("""
<security:definePermission
- permission="Can Do It"
+ permission_id="Can Do It"
title="A Permissive Permission"
description="This permission lets you do anything" />
<security:definePermission
- permission="Can Do It"
+ permission_id="Can Do It"
title="A Permissive Permission"
description="This permission lets you do anything" />
""")
@@ -178,7 +178,7 @@
def testRegister(self):
f = configfile("""
<security:defineRole
- role="Everyperson"
+ role_id="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
""")
@@ -194,12 +194,12 @@
def testDuplicationRegistration(self):
f = configfile("""
<security:defineRole
- role="Everyperson"
+ role_id="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
<security:defineRole
- role="Everyperson"
+ role_id="Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
""")
@@ -219,8 +219,8 @@
def testMap( self ):
f = configfile("""
<security:grantPermissionToRole
- permission="Foo"
- role="Bar" />
+ permission_id="Foo"
+ role_id="Bar" />
""")
xmlconfig(f)
@@ -246,8 +246,8 @@
def testMap( self ):
f = configfile("""
<security:grantPermissionToPrincipal
- permission="Foo"
- principal="Bar" />
+ permission_id="Foo"
+ principal_id="Bar" />
""")
xmlconfig(f)
@@ -273,8 +273,8 @@
def testMap( self ):
f = configfile("""
<security:assignRoleToPrincipal
- role="Foo"
- principal="Bar" />
+ role_id="Foo"
+ principal_id="Bar" />
""")
xmlconfig(f)