Commit 1f851edf authored by Nicolas Dumazet's avatar Nicolas Dumazet

fix test_security_defined_on_class after portal type classes changes

This test checks that wrapping a method in an interaction workflow adds
security to the wrapped method, but that it does not override existing
(class) security definition.

To do so, a private method (doSomethingStupid) is added on Organisation
document class. We really want to change the (static) document class here,
not the portal type class: before portal type classes changes,
ERP5Type.Document.Organisation.Organisation was a copy of the document
ERP5.Document.Organisation.Organisation. After portal classes, the former
is a portal type class, and it does not make sense in test logic to add
a method on the portal type class.

It is correct to change the import path to access the physical Document class.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 69767b4b
...@@ -55,7 +55,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): ...@@ -55,7 +55,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
self.login() self.login()
def beforeTearDown(self): def beforeTearDown(self):
Organisation = Products.ERP5Type.Document.Organisation.Organisation Organisation = Products.ERP5.Document.Organisation.Organisation
Organisation.security.names.pop('doSomethingStupid', None) Organisation.security.names.pop('doSomethingStupid', None)
if hasattr(Organisation, 'doSomethingStupid'): if hasattr(Organisation, 'doSomethingStupid'):
delattr(Organisation, 'doSomethingStupid') delattr(Organisation, 'doSomethingStupid')
...@@ -73,7 +73,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): ...@@ -73,7 +73,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
""" """
""" """
self.setDescription(value) self.setDescription(value)
Organisation = Products.ERP5Type.Document.Organisation.Organisation Organisation = Products.ERP5.Document.Organisation.Organisation
Organisation.doSomethingStupid = doSomethingStupid Organisation.doSomethingStupid = doSomethingStupid
portal_type = self.getTypeTool()['Organisation'] portal_type = self.getTypeTool()['Organisation']
portal_type._setTypeBaseCategoryList(['size']) portal_type._setTypeBaseCategoryList(['size'])
...@@ -623,7 +623,7 @@ context.setTitle('Bar') ...@@ -623,7 +623,7 @@ context.setTitle('Bar')
# wrapping a method in an interaction workflow adds a default security to # wrapping a method in an interaction workflow adds a default security to
# this method, but does not override existing security definition (defined # this method, but does not override existing security definition (defined
# on the class) # on the class)
Organisation = Products.ERP5Type.Document.Organisation.Organisation Organisation = Products.ERP5.Document.Organisation.Organisation
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declarePrivate('doSomethingStupid') security.declarePrivate('doSomethingStupid')
security.apply(Organisation) security.apply(Organisation)
......
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