Commit 9a1ebd19 authored by Romain Courteaud's avatar Romain Courteaud

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."


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29514 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ebaddaa
...@@ -58,6 +58,7 @@ from Products.ERP5Type.tests.utils import FileUpload ...@@ -58,6 +58,7 @@ from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.utils import DummyLocalizer from Products.ERP5Type.tests.utils import DummyLocalizer
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG from zLOG import LOG
from Products.ERP5.Document.Document import NotConvertedError
import os import os
QUIET = 0 QUIET = 0
...@@ -809,6 +810,30 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -809,6 +810,30 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals('ERP5 is a free software.\n', self.assertEquals('ERP5 is a free software.\n',
document.SearchableText()) 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): class TestDocumentWithSecurity(ERP5TypeTestCase):
username = 'yusei' username = 'yusei'
......
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