[Erp5-report] r29978 - /erp5/trunk/products/ERP5/tests/testERP5Web.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 23 15:59:36 CEST 2009


Author: fabien
Date: Fri Oct 23 15:59:34 2009
New Revision: 29978

URL: http://svn.erp5.org?rev=29978&view=rev
Log:
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

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Web.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Web.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Web.py?rev=29978&r1=29977&r2=29978&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] Fri Oct 23 15:59:34 2009
@@ -298,14 +298,17 @@
     """
       Simple Case of showing the proper text content with and without a substitution
       mapping method.
-    """
-    if not run: return
-    if not quiet:
-      message = '\ntest_05_WebPageTextContentSubstituions'
+      In case of asText, the content should be replaced too
+    """
+    if not run: return
+    if not quiet:
+      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 @@
 
     # 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 @@
 
     # Substitutions should occur.
     self.assertEquals(document.asStrippedHTML(), substituted_content)
+    self.assertEquals(document.asText(), substituted_asText_content)
 
     klass._getTestSubstitutionMapping = klass.getTestSubstitutionMapping
     document.setTextContentSubstitutionMappingMethodId('_getTestSubstitutionMapping')




More information about the Erp5-report mailing list