Commit 50e3d535 authored by Gabriel Monnerat's avatar Gabriel Monnerat

add a test to validate if a file in zipfile has prefix 'impr.html'. And bug...

add a test to validate if a file in zipfile has prefix 'impr.html'. And bug fix in cloudoooTestCase because the object config need read some configuration

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37536 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f52875a3
...@@ -47,7 +47,7 @@ def make_suite(test_case): ...@@ -47,7 +47,7 @@ def make_suite(test_case):
def loadConfig(path=None): def loadConfig(path=None):
conf_path = path or join(testcase_path, "..", "samples/cloudooo.conf") conf_path = path or join(testcase_path, "..", "samples/cloudooo.conf")
config.read() config.read(conf_path)
def startFakeEnvironment(start_openoffice=True, conf_path=None): def startFakeEnvironment(start_openoffice=True, conf_path=None):
"""Create a fake environment""" """Create a fake environment"""
......
...@@ -421,7 +421,7 @@ at least v2.0 to extract\n' ...@@ -421,7 +421,7 @@ at least v2.0 to extract\n'
self.assertEquals(response_code, 200) self.assertEquals(response_code, 200)
self.assertEquals(type(response_dict), DictType) self.assertEquals(type(response_dict), DictType)
self.assertNotEquals(response_dict['data'], '') self.assertNotEquals(response_dict['data'], '')
self.assertEquals(response_dict['mime'], 'text/html') self.assertEquals(response_dict['mime'], 'application/zip')
output_url = "./output/zip.zip" output_url = "./output/zip.zip"
open(output_url, 'w').write(decodestring(response_dict['data'])) open(output_url, 'w').write(decodestring(response_dict['data']))
self.assertTrue(is_zipfile(output_url)) self.assertTrue(is_zipfile(output_url))
...@@ -443,7 +443,17 @@ at least v2.0 to extract\n' ...@@ -443,7 +443,17 @@ at least v2.0 to extract\n'
self.assertEquals(response_code, 200) self.assertEquals(response_code, 200)
self.assertEquals(type(response_dict), DictType) self.assertEquals(type(response_dict), DictType)
self.assertNotEquals(response_dict['data'], '') self.assertNotEquals(response_dict['data'], '')
self.assertEquals(response_dict['mime'], 'text/html') self.assertEquals(response_dict['mime'], 'application/zip')
output_url = "./output/zip.zip"
open(output_url, 'w').write(decodestring(response_dict['data']))
self.assertTrue(is_zipfile(output_url))
filename_list = [file.filename for file in ZipFile(output_url).filelist]
for filename in filename_list:
if filename.endswith("impr.html"):
break
else:
self.fail("Not exists one file with 'impr.html' format")
def testRunGenerateMethodFailResponse(self): def testRunGenerateMethodFailResponse(self):
"""Test run_generate method with invalid document""" """Test run_generate method with invalid 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