Commit 02b43105 authored by Jérome Perrin's avatar Jérome Perrin

we can use DummyLocalizer to test that translated workflow state accessors

actually translate


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17888 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aef76517
...@@ -907,12 +907,13 @@ class TestPropertySheet: ...@@ -907,12 +907,13 @@ class TestPropertySheet:
self.assertTrue(person.hasProperty('dummy_ps_prop')) self.assertTrue(person.hasProperty('dummy_ps_prop'))
self.assertEquals('a value', person.getDummyPsProp()) self.assertEquals('a value', person.getDummyPsProp())
def test_17_WorkflowStateAccessor(self,quiet=quiet, run=run_all_test): def test_17_WorkflowStateAccessor(self):
"""Tests for workflow state. assumes that validation state is chained to """Tests for workflow state. assumes that validation state is chained to
the Person portal type and that this workflow has 'validation_state' as the Person portal type and that this workflow has 'validation_state' as
state_variable. state_variable.
""" """
if not run: return self.portal.Localizer = DummyLocalizer()
message_catalog = self.portal.Localizer.erp5_ui
person = self.getPersonModule().newContent(id='1', portal_type='Person') person = self.getPersonModule().newContent(id='1', portal_type='Person')
wf = self.getWorkflowTool().validation_workflow wf = self.getWorkflowTool().validation_workflow
# those are assumptions for this test. # those are assumptions for this test.
...@@ -929,27 +930,29 @@ class TestPropertySheet: ...@@ -929,27 +930,29 @@ class TestPropertySheet:
self.assertEquals(initial_state.getId(), person.getValidationState()) self.assertEquals(initial_state.getId(), person.getValidationState())
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getValidationStateTitle()) person.getValidationStateTitle())
# XXX we do not have translation system set up at that point
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getTranslatedValidationStateTitle()) person.getTranslatedValidationStateTitle())
self.assertTrue([initial_state.title], message_catalog._translated)
self.assertEquals(initial_state.getId(), self.assertEquals(initial_state.getId(),
person.getProperty('validation_state')) person.getProperty('validation_state'))
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getProperty('validation_state_title')) person.getProperty('validation_state_title'))
# XXX we do not have translation system set up at that point message_catalog._translated = []
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getProperty('translated_validation_state_title')) person.getProperty('translated_validation_state_title'))
self.assertTrue([initial_state.title], message_catalog._translated)
# default parameter is accepted by getProperty for compatibility # default parameter is accepted by getProperty for compatibility
self.assertEquals(initial_state.getId(), self.assertEquals(initial_state.getId(),
person.getProperty('validation_state', 'default')) person.getProperty('validation_state', 'default'))
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getProperty('validation_state_title', 'default')) person.getProperty('validation_state_title', 'default'))
# XXX we do not have translation system set up at that point message_catalog._translated = []
self.assertEquals(initial_state.title, self.assertEquals(initial_state.title,
person.getProperty('translated_validation_state_title', person.getProperty('translated_validation_state_title',
'default')) 'default'))
self.assertTrue([initial_state.title], message_catalog._translated)
# pass a transition and check accessors again. # pass a transition and check accessors again.
person.validate() person.validate()
...@@ -962,8 +965,10 @@ class TestPropertySheet: ...@@ -962,8 +965,10 @@ class TestPropertySheet:
person.getProperty('validation_state')) person.getProperty('validation_state'))
self.assertEquals(other_state.title, self.assertEquals(other_state.title,
person.getProperty('validation_state_title')) person.getProperty('validation_state_title'))
message_catalog._translated = []
self.assertEquals(other_state.title, self.assertEquals(other_state.title,
person.getProperty('translated_validation_state_title')) person.getProperty('translated_validation_state_title'))
self.assertTrue([other_state.title], message_catalog._translated)
DEFAULT_ORGANISATION_TITLE_PROP = ''' DEFAULT_ORGANISATION_TITLE_PROP = '''
{ 'id': 'organisation', { 'id': '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