[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests - test_directives.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Mar 20 14:52:49 EST 2004


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

Modified Files:
	test_directives.py 
Log Message:


Implemented permission redefinition portion of ZCMLEnhancements.


=== Zope3/src/zope/app/security/tests/test_directives.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/security/tests/test_directives.py:1.1	Mon Mar  8 07:06:40 2004
+++ Zope3/src/zope/app/security/tests/test_directives.py	Sat Mar 20 14:52:48 2004
@@ -26,6 +26,9 @@
 from zope.app.security import metaconfigure
 from zope.app.security.interfaces import IPermission
 from zope.app.security.permission import Permission
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.configuration import xmlconfig
+from zope.app.security import fields
 
 def pprint(ob, width=70):
     PrettyPrinter(width=width).pprint(ob)
@@ -49,7 +52,7 @@
 
     >>> moduleChecker(test_directives)
     
-    Should get an ewrror if a permission is defined before it's used:
+    Should get an error if a permission isn't defined before it's used:
 
     >>> metaconfigure.protectModule(test_directives, 'foo', test_perm)
     Traceback (most recent call last):
@@ -195,10 +198,32 @@
     
     """
 
+class IDummy(Interface):
+
+    perm = fields.Permission(title=u'')
+
+perms = []
+
+def dummy(context_, perm):
+    global perms
+    perms.append(perm)
+
+
+class DirectivesTest(PlacelessSetup, unittest.TestCase):
+
+    def setUp(self):
+        super(DirectivesTest, self).setUp()
+        from zope.app.security import tests
+        
+        self.context = xmlconfig.file("redefineperms.zcml", tests)
+
+    def testRedefinePermission(self):
+        self.assertEqual(perms, ['zope.Security'])
 
 def test_suite():
     return unittest.TestSuite((
         DocTestSuite(setUp=setUp, tearDown=tearDown),
+        unittest.makeSuite(DirectivesTest),
         ))
 
 if __name__ == '__main__': unittest.main()




More information about the Zope3-Checkins mailing list