[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Security/Registries/tests - testPermissionRegistry.py:1.2
Viktorija Zaksiene
ryzaja@codeworks.lt
Mon, 25 Nov 2002 10:23:21 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/Registries/tests
In directory cvs.zope.org:/tmp/cvs-serv7564/Security/Registries/tests
Modified Files:
testPermissionRegistry.py
Log Message:
Added check for undefined permissions on configuration time.
=== Zope3/lib/python/Zope/App/Security/Registries/tests/testPermissionRegistry.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/Security/Registries/tests/testPermissionRegistry.py:1.1 Thu Jun 20 11:55:02 2002
+++ Zope3/lib/python/Zope/App/Security/Registries/tests/testPermissionRegistry.py Mon Nov 25 10:23:21 2002
@@ -20,6 +20,7 @@
import unittest, sys
from Zope.App.Security.Registries.PermissionRegistry import permissionRegistry
+from Zope.App.Security.Exceptions import UndefinedPermissionError
from Zope.App.Security.IPermission import IPermission
from Interface.Verify import verifyObject
from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
@@ -61,6 +62,15 @@
eq(permission.getTitle(), 'Foo-able')
eq(permission.getDescription(), 'A foo-worthy permission')
+ def testEnsurePermissionDefined(self):
+ permissionRegistry.definePermission('Foo', 'Foo-able',
+ 'A foo-worthy permission')
+ self.assertEqual(None,
+ permissionRegistry.ensurePermissionDefined('Foo'))
+ self.assertRaises(UndefinedPermissionError,
+ permissionRegistry.ensurePermissionDefined,
+ 'Foo.Bar.Spam.Undefined')
+
def test_suite():
loader=unittest.TestLoader()