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

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 9 12:01:06 CEST 2009


Author: romain
Date: Fri Oct  9 12:01:05 2009
New Revision: 29514

URL: http://svn.erp5.org?rev=29514&view=rev
Log:
Check that Base_showFoundText script does not raise error when called on a
document not yet converted. 
Instead, it should return the message "This document is not converted yet."

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=29514&r1=29513&r2=29514&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Fri Oct  9 12:01:05 2009
@@ -58,6 +58,7 @@
 from Products.ERP5Type.tests.utils import DummyLocalizer
 from AccessControl.SecurityManagement import newSecurityManager
 from zLOG import LOG
+from Products.ERP5.Document.Document import NotConvertedError
 import os
 
 QUIET = 0
@@ -809,6 +810,30 @@
     self.assertEquals('ERP5 is a free software.\n',
                       document.SearchableText())
 
+  def test_Base_showFoundText(self):
+    # Create document with good content
+    document = self.portal.document_module.newContent(portal_type='Drawing')
+    self.assertEquals('empty', document.getExternalProcessingState())
+
+    filename = 'TEST-en-002.odt'
+    upload_file = makeFileUpload(filename)
+    document.edit(file=upload_file)
+    transaction.commit()
+    self.tic()
+    self.assertEquals('converted', document.getExternalProcessingState())
+
+    # Upload different type of file inside
+    upload_file = makeFileUpload('REF-en-001.pdf')
+    document.edit(file=upload_file)
+    self.assertEquals('application/pdf', document.getContentType())
+    self.assertEquals('converting', document.getExternalProcessingState())
+    # As document is not converted, text convertion is impossible
+    # But document can still be retrive with portal catalog
+    self.assertRaises(NotConvertedError, document.asText)
+    self.assertRaises(NotConvertedError, document.getSearchableText)
+    self.assertEquals('This document is not converted yet.', 
+                      document.Base_showFoundText())
+
 class TestDocumentWithSecurity(ERP5TypeTestCase):
 
   username = 'yusei'




More information about the Erp5-report mailing list