Commit 41f4c098 authored by Nicolas Delaby's avatar Nicolas Delaby

Only Document which are implemeting IBaseConvertable interface are associated

with processing_status_workflow.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35316 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d1caf99c
...@@ -50,7 +50,6 @@ from Products.CMFCore.utils import getToolByName ...@@ -50,7 +50,6 @@ from Products.CMFCore.utils import getToolByName
TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document') TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document')
FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})" FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?" REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?"
NON_PROCESSABLE_PORTAL_TYPE_LIST = ('Image', 'File', 'PDF')
def printAndLog(msg): def printAndLog(msg):
""" """
...@@ -296,12 +295,9 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -296,12 +295,9 @@ class TestIngestion(ERP5TypeTestCase):
document.edit(file=f) document.edit(file=f)
self.stepTic() self.stepTic()
self.failUnless(document.hasFile()) self.failUnless(document.hasFile())
if document.getPortalType() in NON_PROCESSABLE_PORTAL_TYPE_LIST: if document.isSupportBaseDataConversion():
# File and images do not support conversion to text in DMS # this is how we know if it was ok or not
# PDF has not implemented _convertToBaseFormat() so can not be converted self.assertEquals(document.getExternalProcessingState(), 'converted')
self.assertEquals(document.getExternalProcessingState(), 'empty')
else:
self.assertEquals(document.getExternalProcessingState(), 'converted') # this is how we know if it was ok or not
self.assert_('magic' in document.SearchableText()) self.assert_('magic' in document.SearchableText())
self.assert_('magic' in str(document.asText())) self.assert_('magic' in str(document.asText()))
...@@ -363,11 +359,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -363,11 +359,7 @@ class TestIngestion(ERP5TypeTestCase):
count+=1 count+=1
self.assertEquals(document.getPortalType(), portal_type) self.assertEquals(document.getPortalType(), portal_type)
self.assertEquals(document.getReference(), 'TEST') self.assertEquals(document.getReference(), 'TEST')
if document.getPortalType() in NON_PROCESSABLE_PORTAL_TYPE_LIST: if document.isSupportBaseDataConversion():
# Image, File and PDF are not converted to a base format
# so they have to stay empty
self.assertEquals(document.getExternalProcessingState(), 'empty')
else:
# We check if conversion has succeeded by looking # We check if conversion has succeeded by looking
# at the external_processing workflow # at the external_processing workflow
self.assertEquals(document.getExternalProcessingState(), 'converted') self.assertEquals(document.getExternalProcessingState(), 'converted')
...@@ -960,10 +952,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -960,10 +952,8 @@ class TestIngestion(ERP5TypeTestCase):
language='en', language='en',
version='002') version='002')
self.assertNotEquals(None, ingested_document) self.assertNotEquals(None, ingested_document)
if portal_type not in NON_PROCESSABLE_PORTAL_TYPE_LIST: if ingested_document.isSupportBaseDataConversion():
self.assertEquals('converted', ingested_document.getExternalProcessingState()) self.assertEquals('converted', ingested_document.getExternalProcessingState())
else:
self.assertEquals('empty', ingested_document.getExternalProcessingState())
# check aggregate between 'Document Ingestion Message' and ingested document # check aggregate between 'Document Ingestion Message' and ingested document
self.assertTrue(ingested_document in attachment_list) self.assertTrue(ingested_document in attachment_list)
return attachment_list, ingested_document return attachment_list, ingested_document
......
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