[Erp5-report] r41976 nicolas - /erp5/trunk/products/ERP5OOo/tests/testDms.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jan 4 10:24:35 CET 2011


Author: nicolas
Date: Tue Jan  4 10:24:35 2011
New Revision: 41976

URL: http://svn.erp5.org?rev=41976&view=rev
Log:
Edit web_page with file argument instead text_content argument
te be closer to the reality.

Modified:
    erp5/trunk/products/ERP5OOo/tests/testDms.py

Modified: erp5/trunk/products/ERP5OOo/tests/testDms.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testDms.py?rev=41976&r1=41975&r2=41976&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Tue Jan  4 10:24:35 2011
@@ -1531,9 +1531,23 @@ class TestDocument(TestDocumentMixin):
       </body>
     </html>
     """.decode('utf-8').encode('iso-8859-1')
-    web_page.edit(text_content=html_content)
+    # content encoded into another codec
+    # than utf-8 comes from necessarily an external file
+    # (Ingestion, or FileField), not from user interface 
+    # which is always utf-8.
+    # Edit web_page with a file to force conversion to base_format
+    # as it is done in reality
+
+    # Mimic the behaviour of a FileUpload from WebPage_view
+    file_like = StringIO.StringIO()
+    file_like.write(html_content)
+    setattr(file_like, 'filename', 'something.htm')
+    web_page.edit(file=file_like)
+    # run conversion to base format
+    transaction.commit() 
+    self.tic()
 
-    # Check that outputed stripped html is safe
+    # Check that outputted stripped html is safe
     safe_html = web_page.asStrippedHTML()
     self.assertTrue('My splendid title' in safe_html)
     self.assertTrue('script' not in safe_html, safe_html)



More information about the Erp5-report mailing list