[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testProtectClass.py:1.1.2.14 testPublicClass.py:1.1.2.14 testSecurityDirectives.py:1.1.2.15
Steve Alexander
steve@cat-box.net
Sun, 26 May 2002 08:45:28 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv17123/lib/python/Zope/App/Security/tests
Modified Files:
Tag: Zope-3x-branch
testProtectClass.py testPublicClass.py
testSecurityDirectives.py
Log Message:
changed "name" attribute of protectClass and publicClass zcml directives
to "class".
Note that I haven't touched the dummy protectClass directive in
Zope/Configuration/tests/... as it is only used as an arbitrary
directive for testing the directive-processing machinery.
=== Zope3/lib/python/Zope/App/Security/tests/testProtectClass.py 1.1.2.13 => 1.1.2.14 ===
<directive namespace="http://namespaces.zope.org/security"
name="protectClass"
- attributes="name, permission, interface, methods, like_unto"
+ attributes="class, permission, interface, methods, like_unto"
handler="Zope.App.Security.protectClass.">
<subdirective namespace="http://namespaces.zope.org/security"
name="protect"
@@ -92,7 +92,7 @@
def testClass(self):
declaration = ("""<security:protectClass
- name="%s" permission_id="%s" />"""
+ class="%s" permission_id="%s" />"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
instP=P1)
@@ -102,7 +102,7 @@
def testSimpleMethodsPlural(self):
declaration = ("""<security:protectClass
- name="%s" permission_id="%s"
+ class="%s" permission_id="%s"
names="m1, m3" />"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
@@ -110,7 +110,7 @@
def testSimpleInterface(self):
declaration = ("""<security:protectClass
- name="%s" permission_id="%s" interface="%s" />"""
+ class="%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,
@@ -122,7 +122,7 @@
def testCompositeNoPerm(self):
"""Establish rejection of declarations lacking a permission spec."""
- declaration = ("""<security:protectClass name="%s">
+ declaration = ("""<security:protectClass class="%s">
<security:protect names="m1"/>
</security:protectClass>"""
% (PREFIX+"test_class"))
@@ -130,7 +130,7 @@
self.assertDeclaration,
declaration)
# Permission not in top tag and in one subtag but not in the other:
- declaration = ("""<security:protectClass name="%s">
+ declaration = ("""<security:protectClass class="%s">
<security:protect permission_id="%s"
names="m1"/>
<security:protect
@@ -141,7 +141,7 @@
self.assertDeclaration, declaration, m1P=P1)
def testCompositeMethodTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission_id="%s">
+ declaration = ("""<security:protectClass class="%s" permission_id="%s">
<security:protect names="m1"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -149,7 +149,7 @@
m1P=P1)
def testCompositeMethodElementPerm(self):
- declaration = ("""<security:protectClass name="%s">
+ declaration = ("""<security:protectClass class="%s">
<security:protect permission_id="%s" names="m1"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -157,7 +157,7 @@
m1P=P1)
def testCompositeMethodsPluralTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission_id="%s">
+ declaration = ("""<security:protectClass class="%s" permission_id="%s">
<security:protect names="m1, m2"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1))
@@ -165,7 +165,7 @@
m1P=P1, m2P=P1)
def testCompositeMethodsPluralElementPerm(self):
- declaration = ("""<security:protectClass name="%s">
+ declaration = ("""<security:protectClass class="%s">
<security:protect permission_id="%s"
names="m1, m3"/>
</security:protectClass>"""
@@ -174,7 +174,7 @@
m1P=P1, m3P=P1)
def testCompositeInterfaceTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission_id="%s">
+ declaration = ("""<security:protectClass class="%s" permission_id="%s">
<security:protect interface="%s"/>
</security:protectClass>"""
% (PREFIX+"test_class", P1, PREFIX+"I"))
@@ -182,7 +182,7 @@
m1P=P1, m2P=P1)
def testCompositeInterfaceElementPerm(self):
- declaration = ("""<security:protectClass name="%s">
+ declaration = ("""<security:protectClass class="%s">
<security:protect permission_id="%s"
interface="%s"/>
</security:protectClass>"""
@@ -191,7 +191,7 @@
m1P=P1, m2P=P1)
def testCompositeInstancesTopPerm(self):
- declaration = ("""<security:protectClass name="%s" permission_id="%s">
+ declaration = ("""<security:protectClass class="%s" permission_id="%s">
</security:protectClass>"""
% (PREFIX+"test_class", P1))
self.assertDeclaration(declaration,
@@ -199,7 +199,8 @@
def testSubInterfaces(self):
declaration = ("""<security:protectClass
- name="%s" permission_id="%s" interface="%s" />"""
+ class="%s" permission_id="%s"
+ interface="%s" />"""
% (PREFIX+"test_class", P1, PREFIX+"I2"))
# m1 and m2 are in the interface, so should be set, and m3 should not:
self.assertDeclaration(declaration,
@@ -208,8 +209,8 @@
def testLikeUntoOnly(self):
declaration = ("""
- <security:protectClass name="%s" names="m1,m2" permission_id="%s" />
- <security:protectClass name="%s" like_unto="%s" />
+ <security:protectClass class="%s" names="m1,m2" permission_id="%s" />
+ <security:protectClass class="%s" like_unto="%s" />
""" % (PREFIX+"test_base", P1,
PREFIX+"test_class", PREFIX+"test_base"))
# m1 and m2 are in the interface, so should be set, and m3 should not:
@@ -219,8 +220,8 @@
def testLikeUntoAsDefault(self):
declaration = ("""
- <security:protectClass name="%s" names="m1,m2" permission_id="%s" />
- <security:protectClass name="%s" like_unto="%s"
+ <security:protectClass class="%s" names="m1,m2" permission_id="%s" />
+ <security:protectClass class="%s" like_unto="%s"
names="m2,m3" permission_id="%s"/>
""" % (PREFIX+"test_base", P1,
PREFIX+"test_class", PREFIX+"test_base", P2))
=== Zope3/lib/python/Zope/App/Security/tests/testPublicClass.py 1.1.2.13 => 1.1.2.14 ===
<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
<directive name="publicClass"
- attributes="name, interface, methods"
+ attributes="class, interface, methods"
namespace="http://namespaces.zope.org/security"
handler="Zope.App.Security.publicClass." />
</zopeConfigure>
@@ -72,7 +72,7 @@
self.assertState(**state)
def testClass(self):
- declaration = ("""<security:publicClass name="%s" />"""
+ declaration = ("""<security:publicClass class="%s" />"""
% (PREFIX+"test_class"))
self.assertDeclaration(declaration,
instP=PublicPermission)
@@ -80,28 +80,28 @@
def testInvalidPerm(self):
"""Establish rejection of declarations having a permission spec."""
declaration = (template_bracket
- % """<security:publicClass name="%s"
+ % """<security:publicClass class="%s"
permission_id="X"/>""")
self.assertRaises(InvalidDirective,
self.assertDeclaration,
declaration)
def testMethod(self):
- declaration = ("""<security:publicClass name="%s" names="m1" />"""
+ declaration = ("""<security:publicClass class="%s" names="m1" />"""
% (PREFIX+"test_class"))
self.assertDeclaration(declaration,
instP=PublicPermission, m1P=PublicPermission)
def testMethodsPlural(self):
declaration = ("""<security:publicClass
- name="%s" names="m1, m3" />"""
+ class="%s" names="m1, m3" />"""
% (PREFIX+"test_class"))
self.assertDeclaration(declaration,
instP=PublicPermission, m1P=PublicPermission,
m3P=PublicPermission)
def testInterface(self):
- declaration = ("""<security:publicClass name="%s" interface="%s" />"""
+ declaration = ("""<security:publicClass class="%s" interface="%s" />"""
% (PREFIX+"test_class", PREFIX+"I"))
# m1 and m2 are in the interface, so should be set, and m3 should not:
self.assertDeclaration(declaration,
@@ -110,7 +110,7 @@
def testSubInterfaces(self):
declaration = ("""<security:publicClass
- name="%s" interface="%s" />"""
+ class="%s" interface="%s" />"""
% (PREFIX+"test_class", PREFIX+"I2"))
# m1 and m2 are in the interface, so should be set, and m3 should not:
self.assertDeclaration(declaration,
=== Zope3/lib/python/Zope/App/Security/tests/testSecurityDirectives.py 1.1.2.14 => 1.1.2.15 ===
<directive namespace="http://namespaces.zope.org/security"
name="protectClass"
- attributes="name, permission, interface, methods"
+ attributes="class, permission, interface, methods"
handler="Zope.App.Security.protectClass.">
<subdirective namespace="http://namespaces.zope.org/security"
name="protect"
@@ -68,7 +68,7 @@
</directive>
<directive namespace="http://namespaces.zope.org/security"
name="publicClass"
- attributes="name, interface, methods"
+ attributes="class, interface, methods"
handler="Zope.App.Security.publicClass." />
<directive namespace="http://namespaces.zope.org/security"
name="defaultPolicy"