Commit 972e231e authored by Romain Courteaud's avatar Romain Courteaud

Test _asText script with Address.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9400 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e7f2daa5
......@@ -37,6 +37,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, \
noSecurityManager
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestGis(ERP5TypeTestCase):
......@@ -159,6 +160,46 @@ class TestGis(ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCreateAsTextScript(self, sequence=None, **kw) :
"""
This script returns a different adress format.
"""
createZODBPythonScript(self.getPortal().portal_skins.custom,
'Address_asText', '', """
return '%s\\n%s %s' % \\
(context.getStreetAddress(),
context.getZipCode(), context.getCity())
""")
def stepCheckAddressAsTextScript(self, sequence=None,
sequence_list=None, **kw):
"""
Check getAddressText
"""
address = sequence.get('address')
self.assertEquals(address.asText(),
"%s %s\n%s %s" % (self.street_address_number,
self.street_address_text,
self.zip_code_text,
self.city_text))
def test_02_asTextScript(self, quiet=0, run=run_all_test):
"""
Test property existence
"""
if not run: return
sequence_list = SequenceList()
sequence_string = '\
CreateEntity \
CreateAddress \
SetTextAddressValue \
CreateAsTextScript \
CheckAddressAsTextScript \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
if __name__ == '__main__':
framework()
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