[Zope3-checkins] CVS: Zope3/src/zope/security/tests - test_checker.py:1.4
Jim Fulton
jim@zope.com
Fri, 7 Mar 2003 13:39:48 -0500
Update of /cvs-repository/Zope3/src/zope/security/tests
In directory cvs.zope.org:/tmp/cvs-serv30076/tests
Modified Files:
test_checker.py
Log Message:
Changed the marker object, CheckerPublic to be picklable (as a global
object). This will allow the value to be safely stored in persistent
objects.
=== Zope3/src/zope/security/tests/test_checker.py 1.3 => 1.4 ===
--- Zope3/src/zope/security/tests/test_checker.py:1.3 Mon Dec 30 22:35:15 2002
+++ Zope3/src/zope/security/tests/test_checker.py Fri Mar 7 13:39:44 2003
@@ -25,7 +25,7 @@
from zope.security.management import setSecurityPolicy
from zope.security.proxy import getChecker, getObject
from zope.security.checker import defineChecker
-import types
+import types, pickle
class SecurityPolicy:
@@ -289,9 +289,18 @@
self.assertRaises(Forbidden, checker.check_setattr, inst, 'z')
+class TestCheckerPublic(TestCase):
+
+ def test_that_pickling_retains_identity(self):
+ self.assert_(pickle.loads(pickle.dumps(CheckerPublic))
+ is
+ CheckerPublic)
def test_suite():
- return makeSuite(Test)
+ return TestSuite((
+ makeSuite(Test),
+ makeSuite(TestCheckerPublic),
+ ))
if __name__=='__main__':
main(defaultTest='test_suite')