Commit 93f5487d authored by Romain Courteaud's avatar Romain Courteaud

Add a new test which check that edit can modify wrong tales expression.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8383 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 332f38c0
...@@ -802,6 +802,65 @@ class TestBase(ERP5TypeTestCase): ...@@ -802,6 +802,65 @@ class TestBase(ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def stepCreateBaseCategory(self, sequence=None, sequence_list=None, **kw):
"""
Create a base category.
"""
portal = self.getPortal()
module = portal.portal_categories
object_instance = module.newContent(portal_type="Base Category")
sequence.edit(
object_instance=object_instance,
)
def stepSetBadTalesExpression(self, sequence=None, sequence_list=None, **kw):
"""
Set a wrong tales expression
"""
object_instance = sequence.get('object_instance')
tales_expression = "python: 1 + 'a'"
object_instance.edit(acquisition_portal_type_list=tales_expression)
sequence.edit(
tales_expression=tales_expression,
)
def stepCheckTalesExpression(self, sequence=None, sequence_list=None, **kw):
"""
Set a wrong tales expression
"""
object_instance = sequence.get('object_instance')
tales_expression = sequence.get('tales_expression')
self.assertEquals(object_instance.getAcquisitionPortalTypeList(evaluate=0),
tales_expression)
def stepSetGoodTalesExpression(self, sequence=None,
sequence_list=None, **kw):
"""
Set a wrong tales expression
"""
object_instance = sequence.get('object_instance')
tales_expression = "python: 1 + 1"
object_instance.edit(acquisition_portal_type_list=tales_expression)
sequence.edit(
tales_expression=tales_expression,
)
def test_07_setEditTalesExpression(self, quiet=0, run=run_all_test):
"""
Test if edit update a tales expression.
"""
if not run: return
sequence_list = SequenceList()
sequence_string = '\
CreateBaseCategory \
SetBadTalesExpression \
CheckTalesExpression \
SetGoodTalesExpression \
CheckTalesExpression \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
else: else:
......
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