Commit 193b2b59 authored by Fabien Morin's avatar Fabien Morin

add a test to check that once the document is converted and cached, its size is correctly set

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31634 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a46d13ef
...@@ -977,6 +977,38 @@ class TestDocumentWithSecurity(ERP5TypeTestCase): ...@@ -977,6 +977,38 @@ class TestDocumentWithSecurity(ERP5TypeTestCase):
self.assert_('I use reference to look up TEST' in preview_html) self.assert_('I use reference to look up TEST' in preview_html)
def test_DownloadableDocumentSize(self):
'''Check that once the document is converted and cached, its size is
correctly set'''
portal = self.getPortalObject()
document_module = portal.getDefaultModule('Presentation')
pdf_size = 27131 # octets
# create a text document in document module
text_document = document_module.newContent(portal_type='Text',
reference='Foo_001',
title='Foo_OO1')
f = makeFileUpload('Foo_001.odt')
text_document.edit(file=f.read())
f.close()
transaction.commit()
self.tic()
# the document should be automatically converted to html
self.assertEquals(text_document.getExternalProcessingState(), 'converted')
# check there is nothing in the cache for pdf conversion
self.assertFalse(text_document.hasConversion(format='pdf'))
# call pdf conversion, in this way, the result should be cached
text_document.convert(format='pdf')
# check there is a cache entry for pdf conversion of this document
self.assertTrue(text_document.hasConversion(format='pdf'))
# check the size of the pdf conversion
self.assertEquals(text_document.getConversionSize(format='pdf'), pdf_size)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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