Commit 87c0e746 authored by wenjie.zheng's avatar wenjie.zheng

erp5_workflow: in testWorkflow5Mehtod add modification in Localizer, add Draft translation.

parent de51a27f
...@@ -18,7 +18,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -18,7 +18,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
def test01_Erp5AccessorMethod(self): def test01_Erp5AccessorMethod(self):
"""Generate Transition Methods and test these methods.""" """Generate Transition Methods and test these methods."""
# Create base category as the intermidiate # Create base category as the intermidiate
self.portal.portal_categories.newContent('category_state') self.portal.portal_categories.newContent('new_state')
# Create a workflow # Create a workflow
new_workflow = self.workflow_module.newContent(portal_type='Workflow', new_workflow = self.workflow_module.newContent(portal_type='Workflow',
...@@ -50,14 +50,14 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -50,14 +50,14 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_workflow.setSourceValue(s1) new_workflow.setSourceValue(s1)
# state variable # state variable
new_workflow.setStateBaseCategory('category_state',) new_workflow.setStateBaseCategory('new_state',)
# create a base type and a portal type based on this base type # create a base type and a portal type based on this base type
type_object = self.portal.portal_types.newContent( type_object = self.portal.portal_types.newContent(
portal_type='Base Type', portal_type='Base Type',
id='Object Type', id='Object Type',
type_class='XMLObject', type_class='XMLObject',
type_base_category_list=(['category_state',]) type_base_category_list=(['new_state',])
) )
type_object.edit(type_erp5workflow_list=('new_workflow',)) type_object.edit(type_erp5workflow_list=('new_workflow',))
...@@ -77,37 +77,29 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -77,37 +77,29 @@ class TestERP5Workflow(ERP5TypeTestCase):
self.assertTrue(new_object is not None) self.assertTrue(new_object is not None)
self.assertEqual(new_object.getPortalType(), 'Object Type') self.assertEqual(new_object.getPortalType(), 'Object Type')
self.assertEqual(new_object.getCategoryState(), 'draft')
self.assertEqual(new_object.getCategoryStateTitle(), 'Draft') self.portal.Localizer._default_language = 'fr' # switch language
message_catalog = self.portal.Localizer.erp5_ui
message_catalog.message_edit('Draft', 'fr', 'Brouillon', '')
self.assertEqual(new_object.getNewState(), 'draft')
self.assertEqual(new_object.getNewStateTitle(), 'Draft')
self.assertEqual(new_object.getTranslatedNewStateTitle(), 'Brouillon')
### execute transition ### execute transition
t1.execute(new_object) t1.execute(new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'Validated') self.assertEqual(new_object.getNewStateTitle(), 'Validated')
self.portal.Localizer._default_language = 'fr'
### call accessor ### call accessor
new_object.transition2() new_object.transition2()
self.assertEqual(new_object.getCategoryStateTitle(), 'Draft') self.assertEqual(new_object.getNewStateTitle(), 'Draft')
self.assertEqual(new_object.getTranslatedCategoryStateTitle(), 'Brouillon')
new_object.transition1() new_object.transition1()
self.assertEqual(new_object.getCategoryStateTitle(), 'Validated') self.assertEqual(new_object.getNewStateTitle(), 'Validated')
new_object.setToCouscousPlease() new_object.setToCouscousPlease()
self.assertEqual(new_object.getCategoryStateTitle(), 'Couscous') self.assertEqual(new_object.getNewStateTitle(), 'Couscous')
"""
organisationX = self.portal.organisation_module.newContent(
portal_type='Organisation',
id='orgnisation_x')
self.portal.Localizer._default_language = 'fr'
self.assertEqual(organisationX.getValidationStateTitle(), 'Draft')
self.assertEqual(organisationX.getTranslatedValidationStateTitle(), 'Brouillon')
organisationX.validate()
self.assertEqual(organisationX.getValidationStateTitle(), 'Validated')
"""
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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