Commit b3cac04d authored by Ivan Tyagov's avatar Ivan Tyagov

Fix testing for external state whenever conversion has failed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33689 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 969260ba
...@@ -1232,18 +1232,17 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -1232,18 +1232,17 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
document = self.portal.document_module.newContent(portal_type='Drawing') document = self.portal.document_module.newContent(portal_type='Drawing')
self.assertEquals('empty', document.getExternalProcessingState()) self.assertEquals('empty', document.getExternalProcessingState())
filename = 'TEST-en-002.odt' upload_file = makeFileUpload('TEST-en-002.odt')
upload_file = makeFileUpload(filename)
document.edit(file=upload_file) document.edit(file=upload_file)
transaction.commit() self.stepTic()
self.tic()
self.assertEquals('converted', document.getExternalProcessingState()) self.assertEquals('converted', document.getExternalProcessingState())
# Upload different type of file inside # Upload different type of file inside which can not be converted to base format
upload_file = makeFileUpload('REF-en-001.pdf') upload_file = makeFileUpload('REF-en-001.pdf')
document.edit(file=upload_file) document.edit(file=upload_file)
self.stepTic()
self.assertEquals('application/pdf', document.getContentType()) self.assertEquals('application/pdf', document.getContentType())
self.assertEquals('converting', document.getExternalProcessingState()) self.assertEquals('conversion_failed', document.getExternalProcessingState())
# As document is not converted, text convertion is impossible # As document is not converted, text convertion is impossible
# But document can still be retrive with portal catalog # But document can still be retrive with portal catalog
self.assertRaises(NotConvertedError, document.asText) self.assertRaises(NotConvertedError, document.asText)
...@@ -1251,6 +1250,12 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -1251,6 +1250,12 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals('This document is not converted yet.', self.assertEquals('This document is not converted yet.',
document.Base_showFoundText()) document.Base_showFoundText())
# upload again good content
upload_file = makeFileUpload('TEST-en-002.odt')
document.edit(file=upload_file)
self.stepTic()
self.assertEquals('converted', document.getExternalProcessingState())
def test_Base_createNewFile(self): def test_Base_createNewFile(self):
""" """
Test contributing a file and attaching it to context. Test contributing a file and attaching it to context.
......
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