Commit e97fef23 authored by Jérome Perrin's avatar Jérome Perrin

test translated accessors


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17871 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7354090b
...@@ -32,6 +32,7 @@ import unittest ...@@ -32,6 +32,7 @@ import unittest
from random import randint from random import randint
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyLocalizer
from zLOG import LOG, INFO from zLOG import LOG, INFO
from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.tests.base.testcase import LogInterceptor
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
...@@ -1712,6 +1713,23 @@ class TestPropertySheet: ...@@ -1712,6 +1713,23 @@ class TestPropertySheet:
self.assertEquals(person.getDummyList(), ['value']) self.assertEquals(person.getDummyList(), ['value'])
self.assertEquals(person.getDummySet(), ['value']) self.assertEquals(person.getDummySet(), ['value'])
def test_translated_accessors(self):
self._addProperty('Person', '''{'id': 'dummy',
'type': 'string',
'translatable': 1,
'translation_domain': 'erp5_ui',
'mode': 'w',}''')
self.portal.Localizer = DummyLocalizer()
doc = self.portal.person_module.newContent(portal_type='Person')
# translated and translation domain accessors are generated
self.assertTrue(hasattr(doc, 'getTranslatedDummy'))
self.assertTrue(hasattr(doc, 'getDummyTranslationDomain'))
self.assertEquals('erp5_ui', doc.getDummyTranslationDomain())
doc.setDummy('foo')
self.assertEquals('foo', doc.getTranslatedDummy())
self.assertEquals(['foo'], self.portal.Localizer.erp5_ui._translated)
# _aq_reset should be called implicitly when the system configuration # _aq_reset should be called implicitly when the system configuration
......
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