Commit 4412d057 authored by Fabien Morin's avatar Fabien Morin

add some checks to verify that the text substitution is supported on

web_page converted formats (here text format)
This means that if we have a text substitution in a web_page, the related
asText will take into account this substitution


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29978 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f1f8d64b
......@@ -298,14 +298,17 @@ Hé Hé Hé!""", page.asText().strip())
"""
Simple Case of showing the proper text content with and without a substitution
mapping method.
In case of asText, the content should be replaced too
"""
if not run: return
if not quiet:
message = '\ntest_05_WebPageTextContentSubstituions'
message = '\ntest_05_WebPageTextContentSubstitutions'
ZopeTestCase._print(message)
content = '<a href="${toto}">$titi</a>'
asText_content = '$titi'
substituted_content = '<a href="foo">bar</a>'
substituted_asText_content = 'bar'
mapping = dict(toto='foo', titi='bar')
portal = self.getPortal()
......@@ -314,6 +317,7 @@ Hé Hé Hé!""", page.asText().strip())
# No substitution should occur.
self.assertEquals(document.asStrippedHTML(), content)
self.assertEquals(document.asText(), asText_content)
klass = document.__class__
klass.getTestSubstitutionMapping = lambda self, **kw: mapping
......@@ -321,6 +325,7 @@ Hé Hé Hé!""", page.asText().strip())
# Substitutions should occur.
self.assertEquals(document.asStrippedHTML(), substituted_content)
self.assertEquals(document.asText(), substituted_asText_content)
klass._getTestSubstitutionMapping = klass.getTestSubstitutionMapping
document.setTextContentSubstitutionMappingMethodId('_getTestSubstitutionMapping')
......
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