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: ...@@ -2303,23 +2303,26 @@ class TestPropertySheet:
self.assertFalse(guarded_hasattr(obj, 'getFooBar')) self.assertFalse(guarded_hasattr(obj, 'getFooBar'))
def test_edit(self): def test_edit(self):
# not working in 2.7 as accessor not patched
self._addProperty('Person', try:
''' { 'id': 'foo_bar', from ZODB.Transaction import Transaction
'write_permission' : 'Set own password', except ImportError:
'read_permission' : 'Manage users', self._addProperty('Person',
'type': 'string', ''' { 'id': 'foo_bar',
'mode': 'w', }''') 'write_permission' : 'Set own password',
obj = self.getPersonModule().newContent(portal_type='Person') 'read_permission' : 'Manage users',
obj.edit(foo_bar="v1") 'type': 'string',
self.assertEqual(obj.getFooBar(), "v1") 'mode': 'w', }''')
obj = self.getPersonModule().newContent(portal_type='Person')
obj.manage_permission('Set own password', [], 0) obj.edit(foo_bar="v1")
self.assertRaises(Unauthorized, obj.edit, foo_bar="v2") self.assertEqual(obj.getFooBar(), "v1")
self.assertEqual(obj.getFooBar(), "v1")
obj.manage_permission('Set own password', [], 0)
obj._edit(foo_bar="v3") self.assertRaises(Unauthorized, obj.edit, foo_bar="v2")
self.assertEqual(obj.getFooBar(), "v3") self.assertEqual(obj.getFooBar(), "v1")
obj._edit(foo_bar="v3")
self.assertEqual(obj.getFooBar(), "v3")
class TestAccessControl(ERP5TypeTestCase): 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