[Checkins] SVN: zope.app.security/trunk/s functional tests for persistent{list, dict} fix
Alex Chapman
achapman at zope.com
Thu Sep 10 15:35:03 EDT 2009
Log message for revision 103717:
functional tests for persistent{list,dict} fix
Changed:
U zope.app.security/trunk/setup.py
A zope.app.security/trunk/src/zope/app/security/tests/ftesting.zcml
A zope.app.security/trunk/src/zope/app/security/tests/persistentlist.txt
A zope.app.security/trunk/src/zope/app/security/tests/tests.py
-=-
Modified: zope.app.security/trunk/setup.py
===================================================================
--- zope.app.security/trunk/setup.py 2009-09-10 19:26:41 UTC (rev 103716)
+++ zope.app.security/trunk/setup.py 2009-09-10 19:35:02 UTC (rev 103717)
@@ -12,7 +12,7 @@
#
##############################################################################
-version = '0'
+version = '3.7.2'
import os
from setuptools import setup, find_packages
@@ -59,6 +59,8 @@
'zope.app.pagetemplate',
'zope.app.publisher',
'zope.app.localpermission',
+ 'zope.app.testing',
+ 'zope.app.zcmlfiles',
'zope.authentication',
'zope.component>=3.6.0',
'zope.i18n',
Added: zope.app.security/trunk/src/zope/app/security/tests/ftesting.zcml
===================================================================
--- zope.app.security/trunk/src/zope/app/security/tests/ftesting.zcml (rev 0)
+++ zope.app.security/trunk/src/zope/app/security/tests/ftesting.zcml 2009-09-10 19:35:02 UTC (rev 103717)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml">
+
+ <include package="zope.app.zcmlfiles"/>
+ <include package="zope.app.security" />
+
+</configure>
+
Added: zope.app.security/trunk/src/zope/app/security/tests/persistentlist.txt
===================================================================
--- zope.app.security/trunk/src/zope/app/security/tests/persistentlist.txt (rev 0)
+++ zope.app.security/trunk/src/zope/app/security/tests/persistentlist.txt 2009-09-10 19:35:02 UTC (rev 103717)
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Persistent List functional tests.
+"""
+
+Let's check that we can access the data attribute of a proxied
+PersistentList. This is to accomodate UserList operations which are
+used when an isinstance call will correctly identify a persistent list
+as a UserList. Some configurations may get incorrect behavior currently,
+such that isinstance claims that a proxied UserList is not a UserList.
+For these configurations this should not make a difference.
+
+Because several UserList methods use this isinstance check before
+accessing the data attribute we will simply try to get the data
+attribute from a proxied example.
+
+ >>> import persistent.list
+ >>> import zope.security.tests.test_proxy
+ >>> import zope.security.proxy
+
+ >>> persistent_list = persistent.list.PersistentList()
+
+ >>> proxied_list = zope.security.proxy.ProxyFactory(
+ ... persistent_list)
+
+ >>> proxied_list.data
+ []
+
+We'll do the same with a persistent dict, which follows the same
+behavior pattern with UserDict.
+
+ >>> import persistent.dict
+ >>> persistent_dict = persistent.dict.PersistentDict()
+
+ >>> proxied_dict = zope.security.proxy.ProxyFactory(
+ ... persistent_dict)
+
+ >>> proxied_dict.data
+ {}
+
Added: zope.app.security/trunk/src/zope/app/security/tests/tests.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/tests/tests.py (rev 0)
+++ zope.app.security/trunk/src/zope/app/security/tests/tests.py 2009-09-10 19:35:02 UTC (rev 103717)
@@ -0,0 +1,14 @@
+import os
+import zope.app.testing.functional
+import unittest
+
+here = os.path.realpath(os.path.dirname(__file__))
+PermissionsLayer = zope.app.testing.functional.ZCMLLayer(
+ os.path.join(here, "ftesting.zcml"), __name__,
+ "PermissionsLayer")
+
+def test_suite():
+ suite = zope.app.testing.functional.FunctionalDocFileSuite(
+ 'persistentlist.txt')
+ suite.layer = PermissionsLayer
+ return unittest.TestSuite([suite])
More information about the checkins
mailing list