Commit 2f706057 authored by Gabriel Monnerat's avatar Gabriel Monnerat

add test to validate the png property when odp is converted to html

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@38769 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d90a0b8
......@@ -443,6 +443,33 @@ class TestServer(cloudoooTestCase):
if exists(output_url):
remove(output_url)
def testPNGFileToConvertOdpToHTML(self):
"""Test run_generate method. This test if returns good png files"""
data = open(join('data', 'test_png.odp'),'r').read()
generate_result = self.proxy.run_generate('test_png.odp',
encodestring(data),
None, 'html', 'presentation')
response_code, response_dict, response_message = generate_result
self.assertEquals(response_code, 200)
self.assertEquals(type(response_dict), DictType)
self.assertNotEquals(response_dict['data'], '')
self.assertEquals(response_dict['mime'], 'application/zip')
output_url = join(self.tmp_url, "zip.zip")
open(output_url, 'w').write(decodestring(response_dict['data']))
self.assertTrue(is_zipfile(output_url))
zipfile = ZipFile(output_url)
try:
png_path = join(self.tmp_url, "img0.png")
zipfile.extractall(self.tmp_url)
stdout, stderr = Popen("file -b %s" % png_path, shell=True,
stdout=PIPE).communicate()
self.assertEquals(stdout.startswith('PNG image data'), True, stdout)
self.assertTrue("8-bit/color RGB" in stdout, stdout)
finally:
zipfile.close()
if exists(output_url):
remove(output_url)
def testRunGenerateMethodConvertOdpToHTML(self):
"""Test run_generate method. This test is to validate a bug convertions to
html"""
......
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