Commit cd2f5333 authored by Aurel's avatar Aurel

do not test security in edit in zope2.7 as it depends on accessor

security with is disabled for these zope version


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21499 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0126dc3d
......@@ -2303,23 +2303,26 @@ class TestPropertySheet:
self.assertFalse(guarded_hasattr(obj, 'getFooBar'))
def test_edit(self):
self._addProperty('Person',
''' { 'id': 'foo_bar',
'write_permission' : 'Set own password',
'read_permission' : 'Manage users',
'type': 'string',
'mode': 'w', }''')
obj = self.getPersonModule().newContent(portal_type='Person')
obj.edit(foo_bar="v1")
self.assertEqual(obj.getFooBar(), "v1")
obj.manage_permission('Set own password', [], 0)
self.assertRaises(Unauthorized, obj.edit, foo_bar="v2")
self.assertEqual(obj.getFooBar(), "v1")
obj._edit(foo_bar="v3")
self.assertEqual(obj.getFooBar(), "v3")
# not working in 2.7 as accessor not patched
try:
from ZODB.Transaction import Transaction
except ImportError:
self._addProperty('Person',
''' { 'id': 'foo_bar',
'write_permission' : 'Set own password',
'read_permission' : 'Manage users',
'type': 'string',
'mode': 'w', }''')
obj = self.getPersonModule().newContent(portal_type='Person')
obj.edit(foo_bar="v1")
self.assertEqual(obj.getFooBar(), "v1")
obj.manage_permission('Set own password', [], 0)
self.assertRaises(Unauthorized, obj.edit, foo_bar="v2")
self.assertEqual(obj.getFooBar(), "v1")
obj._edit(foo_bar="v3")
self.assertEqual(obj.getFooBar(), "v3")
class TestAccessControl(ERP5TypeTestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment