[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - zope2testbase.py:1.2
Shane Hathaway
shane@zope.com
Fri, 11 Apr 2003 23:40:08 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv20047/tests
Modified Files:
zope2testbase.py
Log Message:
Added tests for the bugfixes contributed by Christian Zagrodnick.
=== Products/Ape/lib/apelib/tests/zope2testbase.py 1.1 => 1.2 ===
--- Products/Ape/lib/apelib/tests/zope2testbase.py:1.1 Wed Apr 9 23:09:57 2003
+++ Products/Ape/lib/apelib/tests/zope2testbase.py Fri Apr 11 23:39:37 2003
@@ -18,6 +18,7 @@
from cStringIO import StringIO
import time
+from types import ListType, TupleType
from Acquisition import aq_base
from ZODB import Persistent, POSException
@@ -425,7 +426,7 @@
conn.close()
- def testPythonScript(self):
+ def testPythonScript(self, with_proxy_roles=0):
conn = self.db.open()
try:
app = conn.root()['Application']
@@ -433,6 +434,9 @@
script.write('##title=test script\nreturn "OK"')
script._makeFunction()
app._setObject(script.id, script, set_owner=0)
+ if with_proxy_roles:
+ # set a proxy role and verify nothing breaks
+ script._proxy_roles = ('System Administrator',)
get_transaction().commit()
conn2 = self.db.open()
@@ -449,6 +453,12 @@
conn.close()
+ def testPythonScriptWithProxyRoles(self):
+ # This once failed because PythonScripts check proxy roles
+ # on calls to write().
+ self.testPythonScript(with_proxy_roles=1)
+
+
def testDTMLMethod(self):
conn = self.db.open()
try:
@@ -514,7 +524,8 @@
f.__ac_roles__ = ['Elder', 'Missionary']
f.__ac_local_roles__ = {'shane': ['Missionary']}
f._proxy_roles = ['Manager']
- f._View_Permission = ['Owner', 'Elder']
+ f._View_Permission = ('Owner', 'Elder')
+ f._Add_Folders_Permission = ['Elder']
get_transaction().commit()
@@ -534,6 +545,10 @@
self.assertEqual(roles, {'Elder':1, 'Missionary':1})
self.assertEqual(tuple(f2._proxy_roles), ('Manager',))
+ self.assert_(isinstance(f2._View_Permission, TupleType),
+ "View permission should not be acquired")
+ self.assert_(isinstance(f2._Add_Folders_Permission, ListType),
+ "Add Folders permission should be acquired")
roles = {}
for role in list(f2._View_Permission):
roles[role] = 1