Commit 3aecbb02 authored by Priscila Manhaes's avatar Priscila Manhaes

Refactor to verify files that does not informe destination mimetype and to message in case of error

parent e24cd9e9
......@@ -43,12 +43,24 @@ class TestCase(unittest.TestCase):
def _testConvertFile(self, input_url, source_format, destination_format,
destination_mimetype, zip=False):
""" Generic test for converting file """
fault_list = []
try:
output_data = self.proxy.convertFile(encodestring(open(input_url).read()),
source_format,
destination_format,
zip)
file_type = self._getFileType(output_data)
if destination_mimetype != None:
self.assertEquals(file_type, destination_mimetype)
else:
if file_type.endswith(": empty"):
fault_list.append((source_format, destination_format, file_type))
except Fault, err:
fault_list.append((source_format, destination_format, err.faultString))
if fault_list:
template_message = 'input_format: %r\noutput_format: %r\n traceback:\n%s'
message = '\n'.join([template_message % fault for fault in fault_list])
self.fail('Failed Conversions:\n' + message)
def _testFaultConversion(self, data, source_format, destination_format):
""" Generic test for fail converting"""
......
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