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): ...@@ -43,12 +43,24 @@ class TestCase(unittest.TestCase):
def _testConvertFile(self, input_url, source_format, destination_format, def _testConvertFile(self, input_url, source_format, destination_format,
destination_mimetype, zip=False): destination_mimetype, zip=False):
""" Generic test for converting file """ """ Generic test for converting file """
output_data = self.proxy.convertFile(encodestring(open(input_url).read()), fault_list = []
source_format, try:
destination_format, output_data = self.proxy.convertFile(encodestring(open(input_url).read()),
zip) source_format,
file_type = self._getFileType(output_data) destination_format,
self.assertEquals(file_type, destination_mimetype) 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): def _testFaultConversion(self, data, source_format, destination_format):
""" Generic test for fail converting""" """ 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