Commit 72da57bf authored by Jérome Perrin's avatar Jérome Perrin

ooo: target libreoffice 7.5

( tested with 7.5.2.2 )
parent fbd8591e
...@@ -85,6 +85,7 @@ class MimeMapper: ...@@ -85,6 +85,7 @@ class MimeMapper:
alternative_extension_dict = { alternative_extension_dict = {
'Microsoft Excel 2007 XML':'ms.xlsx', 'Microsoft Excel 2007 XML':'ms.xlsx',
'Microsoft Excel 2007-2013 XML':'ms.xlsx', 'Microsoft Excel 2007-2013 XML':'ms.xlsx',
'Excel 2007–365':'ms.xlsx',
'Microsoft Excel 5.0':'5.xls', 'Microsoft Excel 5.0':'5.xls',
'Microsoft Excel 95':'95.xls', 'Microsoft Excel 95':'95.xls',
'Microsoft PowerPoint 2007 XML AutoPlay':'ms.ppsx', 'Microsoft PowerPoint 2007 XML AutoPlay':'ms.ppsx',
...@@ -93,8 +94,10 @@ class MimeMapper: ...@@ -93,8 +94,10 @@ class MimeMapper:
'Microsoft PowerPoint 2007-2013 XML':'ms.pptx', 'Microsoft PowerPoint 2007-2013 XML':'ms.pptx',
'Microsoft Word 2007 XML':'ms.docx', 'Microsoft Word 2007 XML':'ms.docx',
'Microsoft Word 2007-2013 XML':'ms.docx', 'Microsoft Word 2007-2013 XML':'ms.docx',
'Word 2007–365':'ms.docx',
'Microsoft Word 6.0':'6.doc', 'Microsoft Word 6.0':'6.doc',
'Microsoft Word 95':'95.doc', 'Microsoft Word 95':'95.doc',
'TIFF - Tagged Image File Format': 'tiff',
} }
uno_path = kw.get("uno_path", environ.get('uno_path')) uno_path = kw.get("uno_path", environ.get('uno_path'))
office_binary_path = kw.get("office_binary_path", office_binary_path = kw.get("office_binary_path",
...@@ -115,14 +118,15 @@ class MimeMapper: ...@@ -115,14 +118,15 @@ class MimeMapper:
filter_dict, type_dict = json.loads(stdout) filter_dict, type_dict = json.loads(stdout)
ooo_disable_filter_list = kw.get("ooo_disable_filter_list") or [] + [ ooo_disable_filter_list = kw.get("ooo_disable_filter_list") or [] + [
# 'writer_jpg_Export', # Seems not working from cloudooo in Libre Office 4.3.3.2 # https://bugs.documentfoundation.org/show_bug.cgi?id=117252
# 'writer_png_Export', # Seems not working from cloudooo in Libre Office 4.3.3.2 'writer_web_jpg_Export',
# 'draw_eps_Export', # Seems not working from cloudooo in Libre Office 5.0.0.5 'writer_web_png_Export',
# 'impress_eps_Export', # Seems not working from cloudooo in Libre Office 5.0.0.5 'writer_web_webp_Export',
] ]
ooo_disable_filter_name_list = kw.get("ooo_disable_filter_name_list") or [] + [ ooo_disable_filter_name_list = kw.get("ooo_disable_filter_name_list") or [] + [
'Text', # Use 'Text - Choose Encoding' instead 'Text', # Use 'Text - Choose Encoding' instead
'Text (StarWriter/Web)', # Use 'Text - Choose Encoding (Writer/Web)' instead 'Text (StarWriter/Web)', # Use 'Text - Choose Encoding (Writer/Web)' instead
'ODF Drawing (Impress)', # broken for presentation
] ]
for filter_name, value in filter_dict.items(): for filter_name, value in filter_dict.items():
if filter_name in ooo_disable_filter_list: if filter_name in ooo_disable_filter_list:
...@@ -130,6 +134,8 @@ class MimeMapper: ...@@ -130,6 +134,8 @@ class MimeMapper:
ui_name = value.get('UIName') ui_name = value.get('UIName')
filter_type = value.get('Type') filter_type = value.get('Type')
filter_type_dict = type_dict.get(filter_type) filter_type_dict = type_dict.get(filter_type)
if not filter_type_dict:
continue
if not ui_name: if not ui_name:
ui_name = filter_type_dict.get("UIName") ui_name = filter_type_dict.get("UIName")
if ui_name in ooo_disable_filter_name_list or 'Template' in ui_name: if ui_name in ooo_disable_filter_name_list or 'Template' in ui_name:
......
...@@ -72,4 +72,9 @@ class TestAllFormatsERP5Compatibility(TestCase): ...@@ -72,4 +72,9 @@ class TestAllFormatsERP5Compatibility(TestCase):
data_output = data_output['data'] data_output = data_output['data']
file_type = self._getFileType(data_output) file_type = self._getFileType(data_output)
self.assertNotIn(": empty", file_type) self.assertNotIn(": empty", file_type)
if source_format != extension:
# when no filter exist for destination format, the document is not converted
# but silently returned in source format, the assertion below should detect
# this.
self.assertNotEqual(source_mimetype, file_type)
...@@ -200,15 +200,17 @@ class TestHandler(HandlerTestCase): ...@@ -200,15 +200,17 @@ class TestHandler(HandlerTestCase):
def get(*args, **kw): def get(*args, **kw):
return sorted(Handler.getAllowedConversionFormatList(*args, **kw)) return sorted(Handler.getAllowedConversionFormatList(*args, **kw))
text_plain_output_list = [ text_plain_output_list = [
('application/msword', 'Microsoft Word 97-2003'), ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding')] ('text/plain', 'Text - Choose Encoding')]
self.assertEqual(get("text/plain;ignored=param"), text_plain_output_list) self.assertEqual(get("text/plain;ignored=param"), text_plain_output_list)
...@@ -219,15 +221,17 @@ class TestHandler(HandlerTestCase): ...@@ -219,15 +221,17 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for application/msword""" """Test allowed conversion format for application/msword"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/msword;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/msword;ignored=param")),
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding') ]) ('text/plain', 'Text - Choose Encoding') ])
...@@ -238,12 +242,16 @@ class TestHandler(HandlerTestCase): ...@@ -238,12 +242,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -261,15 +269,17 @@ class TestHandler(HandlerTestCase): ...@@ -261,15 +269,17 @@ class TestHandler(HandlerTestCase):
): ):
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList(content_type)), [ sorted(Handler.getAllowedConversionFormatList(content_type)), [
('application/msword', 'Microsoft Word 97-2003'), ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding'), ('text/plain', 'Text - Choose Encoding'),
]) ])
...@@ -278,15 +288,17 @@ class TestHandler(HandlerTestCase): ...@@ -278,15 +288,17 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for application/vnd.openxmlformats-officedocument.wordprocessingml.document""" """Test allowed conversion format for application/vnd.openxmlformats-officedocument.wordprocessingml.document"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param")),
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding') ]) ('text/plain', 'Text - Choose Encoding') ])
...@@ -297,12 +309,16 @@ class TestHandler(HandlerTestCase): ...@@ -297,12 +309,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -313,12 +329,16 @@ class TestHandler(HandlerTestCase): ...@@ -313,12 +329,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -326,23 +346,25 @@ class TestHandler(HandlerTestCase): ...@@ -326,23 +346,25 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for text/html""" """Test allowed conversion format for text/html"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("text/html;ignored=param")), sorted(Handler.getAllowedConversionFormatList("text/html;ignored=param")),
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', u'Flat XML ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text', 'Text (Writer/Web)'), ('application/vnd.oasis.opendocument.text', 'Text (Writer/Web)'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'), ('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document'), ('text/html', 'HTML Document'),
('text/html', 'HTML Document (Calc)'), ('text/html', 'HTML Document (Calc)'),
...@@ -358,12 +380,16 @@ class TestHandler(HandlerTestCase): ...@@ -358,12 +380,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -374,12 +400,16 @@ class TestHandler(HandlerTestCase): ...@@ -374,12 +400,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -390,12 +420,16 @@ class TestHandler(HandlerTestCase): ...@@ -390,12 +420,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -403,17 +437,31 @@ class TestHandler(HandlerTestCase): ...@@ -403,17 +437,31 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for image/svg+xml""" """Test allowed conversion format for image/svg+xml"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("image/svg+xml;ignored=param")), sorted(Handler.getAllowedConversionFormatList("image/svg+xml;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003 AutoPlay'),
('image/gif', 'GIF - Graphics Interchange Format'), ('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'PowerPoint 2007–365 VBA'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('image/png', 'PNG - Portable Network Graphic'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('application/vnd.oasis.opendocument.presentation-flat-xml', 'Flat XML ODF Presentation'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'),
('text/html', 'HTML Document (Draw)') ]) ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'PowerPoint 2007–365'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'PowerPoint 2007–365 AutoPlay'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)'),
('text/html', 'HTML Document (Impress)') ])
def testGetAllowedConversionFormatList_ImageTiff(self): def testGetAllowedConversionFormatList_ImageTiff(self):
"""Test allowed conversion format for image/tiff""" """Test allowed conversion format for image/tiff"""
...@@ -422,14 +470,18 @@ class TestHandler(HandlerTestCase): ...@@ -422,14 +470,18 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)')])
def testGetAllowedConversionFormatList_ImageXCmuRaster(self): def testGetAllowedConversionFormatList_ImageXCmuRaster(self):
"""Test allowed conversion format for image/x-cmu-raster""" """Test allowed conversion format for image/x-cmu-raster"""
...@@ -438,12 +490,16 @@ class TestHandler(HandlerTestCase): ...@@ -438,12 +490,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -454,12 +510,16 @@ class TestHandler(HandlerTestCase): ...@@ -454,12 +510,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -470,12 +530,16 @@ class TestHandler(HandlerTestCase): ...@@ -470,12 +530,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -486,12 +550,16 @@ class TestHandler(HandlerTestCase): ...@@ -486,12 +550,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -502,12 +570,16 @@ class TestHandler(HandlerTestCase): ...@@ -502,12 +570,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -518,12 +590,16 @@ class TestHandler(HandlerTestCase): ...@@ -518,12 +590,16 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('application/vnd.oasis.opendocument.graphics-flat-xml', u'Flat XML ODF Drawing'), ('application/vnd.oasis.opendocument.graphics-flat-xml', 'Flat XML ODF Drawing'),
('application/x-ms-wmz', 'WMZ - Compressed Windows Metafile'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/svg+xml', 'SVGZ - Compressed Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
...@@ -532,13 +608,14 @@ class TestHandler(HandlerTestCase): ...@@ -532,13 +608,14 @@ class TestHandler(HandlerTestCase):
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/vnd.ms-excel;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.ms-excel;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', u'Flat XML ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('image/png', 'PNG - Portable Network Graphic'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document (Calc)') ]) ('text/html', 'HTML Document (Calc)') ])
...@@ -553,13 +630,14 @@ class TestHandler(HandlerTestCase): ...@@ -553,13 +630,14 @@ class TestHandler(HandlerTestCase):
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.spreadsheet;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.spreadsheet;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', u'Flat XML ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('image/png', 'PNG - Portable Network Graphic'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document (Calc)') ]) ('text/html', 'HTML Document (Calc)') ])
...@@ -568,13 +646,14 @@ class TestHandler(HandlerTestCase): ...@@ -568,13 +646,14 @@ class TestHandler(HandlerTestCase):
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', u'Flat XML ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('image/png', 'PNG - Portable Network Graphic'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphics'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document (Calc)') ]) ('text/html', 'HTML Document (Calc)') ])
...@@ -582,15 +661,17 @@ class TestHandler(HandlerTestCase): ...@@ -582,15 +661,17 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for application/vnd.sun.xml.writer""" """Test allowed conversion format for application/vnd.sun.xml.writer"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("application/vnd.sun.xml.writer;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.sun.xml.writer;ignored=param")),
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding') ]) ('text/plain', 'Text - Choose Encoding') ])
...@@ -598,23 +679,25 @@ class TestHandler(HandlerTestCase): ...@@ -598,23 +679,25 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for text/csv""" """Test allowed conversion format for text/csv"""
self.assertEqual( self.assertEqual(
sorted(Handler.getAllowedConversionFormatList("text/csv;ignored=param")), sorted(Handler.getAllowedConversionFormatList("text/csv;ignored=param")),
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/epub+zip', 'EPUB Document'),
('application/msword', 'Word 97–2003'),
('application/pdf', 'PDF - Portable Document Format'), ('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Excel 97–2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Excel 2007–365 (macro-enabled)'),
('application/vnd.ms-word.document.macroEnabled.12', 'Word 2007–365 VBA'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.oasis.opendocument.spreadsheet-flat-xml', u'Flat XML ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet-flat-xml', 'Flat XML ODF Spreadsheet'),
('application/vnd.oasis.opendocument.text', 'ODF Text Document'), ('application/vnd.oasis.opendocument.text', 'ODF Text Document'),
('application/vnd.oasis.opendocument.text', 'Text (Writer/Web)'), ('application/vnd.oasis.opendocument.text', 'Text (Writer/Web)'),
('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'), ('application/vnd.oasis.opendocument.text-flat-xml', 'Flat XML ODF Text Document'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Excel 2007–365'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Microsoft Word 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text (Transitional)'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Word 2007–365'),
('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'), ('application/vnd.sun.xml.writer', 'OpenOffice.org 1.0 Text Document (Writer/Web)'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document'), ('text/html', 'HTML Document'),
('text/html', 'HTML Document (Calc)'), ('text/html', 'HTML Document (Calc)'),
...@@ -629,20 +712,22 @@ class TestHandler(HandlerTestCase): ...@@ -629,20 +712,22 @@ class TestHandler(HandlerTestCase):
sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.presentation;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.presentation;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'PowerPoint 2007–365 VBA'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.oasis.opendocument.presentation-flat-xml', u'Flat XML ODF Presentation'), ('application/vnd.oasis.opendocument.presentation-flat-xml', 'Flat XML ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), # TEST it ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'PowerPoint 2007–365'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'PowerPoint 2007–365 AutoPlay'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
...@@ -652,20 +737,22 @@ class TestHandler(HandlerTestCase): ...@@ -652,20 +737,22 @@ class TestHandler(HandlerTestCase):
sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'PowerPoint 2007–365 VBA'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.oasis.opendocument.presentation-flat-xml', u'Flat XML ODF Presentation'), ('application/vnd.oasis.opendocument.presentation-flat-xml', 'Flat XML ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'PowerPoint 2007–365'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'PowerPoint 2007–365 AutoPlay'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
...@@ -675,20 +762,22 @@ class TestHandler(HandlerTestCase): ...@@ -675,20 +762,22 @@ class TestHandler(HandlerTestCase):
sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.presentationml.slideshow;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.openxmlformats-officedocument.presentationml.slideshow;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'PowerPoint 2007–365 VBA'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.oasis.opendocument.presentation-flat-xml', u'Flat XML ODF Presentation'), ('application/vnd.oasis.opendocument.presentation-flat-xml', 'Flat XML ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'PowerPoint 2007–365'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'PowerPoint 2007–365 AutoPlay'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
...@@ -698,20 +787,21 @@ class TestHandler(HandlerTestCase): ...@@ -698,20 +787,21 @@ class TestHandler(HandlerTestCase):
sorted(Handler.getAllowedConversionFormatList("application/vnd.ms-powerpoint;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.ms-powerpoint;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'PowerPoint 97–2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'PowerPoint 2007–365 VBA'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.oasis.opendocument.presentation-flat-xml', u'Flat XML ODF Presentation'), ('application/vnd.oasis.opendocument.presentation-flat-xml', 'Flat XML ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Office Open XML Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'PowerPoint 2007–365'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'PowerPoint 2007–365 AutoPlay'),
('image/emf', 'EMF - Enhanced Metafile'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'), ('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphics'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/wmf', 'WMF - Windows Metafile'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
...@@ -32,19 +32,26 @@ from cloudooo.tests.handlerTestCase import HandlerTestCase ...@@ -32,19 +32,26 @@ from cloudooo.tests.handlerTestCase import HandlerTestCase
from cloudooo.handler.ooo.application.openoffice import openoffice from cloudooo.handler.ooo.application.openoffice import openoffice
from cloudooo.handler.ooo.mimemapper import MimeMapper from cloudooo.handler.ooo.mimemapper import MimeMapper
# XXX depending on wether allowed targets are evaluated by mime or by
# extension/document_type, the returned mime types are different for text
text_expected_tuple = ( text_expected_tuple = (
('doc', 'Microsoft Word 97-2003'), ('doc', 'Word 97–2003'),
('ms.docx', 'Microsoft Word 2007-2013 XML'), ('docx', 'Office Open XML Text (Transitional)'),
('docx', 'Office Open XML Text'), ('epub', 'EPUB Document'),
('fodt', 'Flat XML ODF Text Document'), ('fodt', 'Flat XML ODF Text Document'),
('html', 'HTML Document (Writer)'), ('html', 'HTML Document (Writer)'),
('jpg', 'JPEG - Joint Photographic Experts Group'), ('jpg', 'JPEG - Joint Photographic Experts Group'),
('ms.docx', 'Word 2007–365'),
('odt', 'ODF Text Document'), ('odt', 'ODF Text Document'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('png', 'PNG - Portable Network Graphic'), ('png', 'PNG - Portable Network Graphics'),
('rtf', 'Rich Text'), ('rtf', 'Rich Text'),
('txt', 'Text - Choose Encoding'), ('txt', 'Text - Choose Encoding'),
) )
extra_text_expected_tuple = (
('docm', 'Word 2007–365 VBA'),
('webp', 'WEBP - WebP Image'),
)
global_expected_tuple = ( global_expected_tuple = (
) )
...@@ -52,33 +59,27 @@ global_expected_tuple = ( ...@@ -52,33 +59,27 @@ global_expected_tuple = (
drawing_expected_tuple = ( drawing_expected_tuple = (
('bmp', 'BMP - Windows Bitmap'), ('bmp', 'BMP - Windows Bitmap'),
('emf', 'EMF - Enhanced Metafile'), ('emf', 'EMF - Enhanced Metafile'),
('emz', 'EMZ - Compressed Enhanced Metafile'),
('eps', 'EPS - Encapsulated PostScript'), ('eps', 'EPS - Encapsulated PostScript'),
('fodg', 'Flat XML ODF Drawing'), ('fodg', 'Flat XML ODF Drawing'),
('gif', 'GIF - Graphics Interchange Format'), ('gif', 'GIF - Graphics Interchange Format'),
('html', 'HTML Document (Draw)'), ('html', 'HTML Document (Draw)'),
('jpg', 'JPEG - Joint Photographic Experts Group'), ('jpg', 'JPEG - Joint Photographic Experts Group'),
('met', 'MET - OS/2 Metafile'),
('odg', 'ODF Drawing'), ('odg', 'ODF Drawing'),
('pbm', 'PBM - Portable Bitmap'),
('pct', 'PCT - Mac Pict'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('pgm', 'PGM - Portable Graymap'), ('png', 'PNG - Portable Network Graphics'),
('png', 'PNG - Portable Network Graphic'),
('ppm', 'PPM - Portable Pixelmap'),
('ras', 'RAS - Sun Raster Image'),
('svg', 'SVG - Scalable Vector Graphics'), ('svg', 'SVG - Scalable Vector Graphics'),
('svm', 'SVM - StarView Metafile'), ('svgz', 'SVGZ - Compressed Scalable Vector Graphics'),
('tif', 'TIFF - Tagged Image File Format'), ('tiff', 'TIFF - Tagged Image File Format'),
('webp', 'WEBP - WebP Image'),
('wmf', 'WMF - Windows Metafile'), ('wmf', 'WMF - Windows Metafile'),
('xpm', 'XPM - X PixMap'), ('wmz', 'WMZ - Compressed Windows Metafile'),
) )
web_expected_tuple = ( web_expected_tuple = (
('html', 'HTML Document'), ('html', 'HTML Document'),
('jpg', 'JPEG - Joint Photographic Experts Group'),
('odt', 'Text (Writer/Web)'), ('odt', 'Text (Writer/Web)'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('png', 'PNG - Portable Network Graphic'),
('sxw', 'OpenOffice.org 1.0 Text Document (Writer/Web)'), ('sxw', 'OpenOffice.org 1.0 Text Document (Writer/Web)'),
('txt', 'Text (Writer/Web)'), ('txt', 'Text (Writer/Web)'),
('txt', 'Text - Choose Encoding (Writer/Web)'), ('txt', 'Text - Choose Encoding (Writer/Web)'),
...@@ -92,40 +93,35 @@ presentation_expected_tuple = ( ...@@ -92,40 +93,35 @@ presentation_expected_tuple = (
('gif', 'GIF - Graphics Interchange Format'), ('gif', 'GIF - Graphics Interchange Format'),
('html', 'HTML Document (Impress)'), ('html', 'HTML Document (Impress)'),
('jpg', 'JPEG - Joint Photographic Experts Group'), ('jpg', 'JPEG - Joint Photographic Experts Group'),
('met', 'MET - OS/2 Metafile'),
('odg', 'ODF Drawing (Impress)'),
('odp', 'ODF Presentation'), ('odp', 'ODF Presentation'),
('pbm', 'PBM - Portable Bitmap'),
('pct', 'PCT - Mac Pict'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('pgm', 'PGM - Portable Graymap'), ('png', 'PNG - Portable Network Graphics'),
('png', 'PNG - Portable Network Graphic'), ('pps', 'PowerPoint 97–2003 AutoPlay'),
('ppm', 'PPM - Portable Pixelmap'),
('pps', 'Microsoft PowerPoint 97-2003 AutoPlay'),
('ms.ppsx', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'),
('ppsx', 'Office Open XML Presentation AutoPlay'), ('ppsx', 'Office Open XML Presentation AutoPlay'),
('ppt', 'Microsoft PowerPoint 97-2003'), ('ppsx', 'PowerPoint 2007–365 AutoPlay'),
('ms.pptx', 'Microsoft PowerPoint 2007-2013 XML'), ('ppt', 'PowerPoint 97–2003'),
('pptm', 'PowerPoint 2007–365 VBA'),
('pptx', 'Office Open XML Presentation'), ('pptx', 'Office Open XML Presentation'),
('ras', 'RAS - Sun Raster Image'), ('pptx', 'PowerPoint 2007–365'),
('svg', 'SVG - Scalable Vector Graphics'), ('svg', 'SVG - Scalable Vector Graphics'),
('svm', 'SVM - StarView Metafile'), ('tiff', 'TIFF - Tagged Image File Format'),
('tif', 'TIFF - Tagged Image File Format'), ('webp', 'WEBP - WebP Image'),
('wmf', 'WMF - Windows Metafile'), ('wmf', 'WMF - Windows Metafile'),
('xpm', 'XPM - X PixMap'),
) )
spreadsheet_expected_tuple = ( spreadsheet_expected_tuple = (
('csv', 'Text CSV'), ('csv', 'Text CSV'),
('fods', 'Flat XML ODF Spreadsheet'), ('fods', 'Flat XML ODF Spreadsheet'),
('html', 'HTML Document (Calc)'), ('html', 'HTML Document (Calc)'),
('jpg', 'JPEG - Joint Photographic Experts Group'),
('ods', 'ODF Spreadsheet'), ('ods', 'ODF Spreadsheet'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('png', 'PNG - Portable Network Graphic'), ('png', 'PNG - Portable Network Graphics'),
('slk', 'SYLK'), ('slk', 'SYLK'),
('xls', 'Microsoft Excel 97-2003'), ('webp', 'WEBP - WebP Image'),
('xlsm', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('xls', 'Excel 97–2003'),
('ms.xlsx', 'Microsoft Excel 2007-2013 XML'), ('ms.xlsx', 'Excel 2007–365'),
('xlsm', 'Excel 2007–365 (macro-enabled)'),
('xlsx', 'Office Open XML Spreadsheet'), ('xlsx', 'Office Open XML Spreadsheet'),
) )
...@@ -138,9 +134,6 @@ math_expected_tuple = ( ...@@ -138,9 +134,6 @@ math_expected_tuple = (
('smf', 'StarMath 5.0'), ('smf', 'StarMath 5.0'),
) )
chart_expected_tuple = (
('odc', 'ODF Chart'),
)
OPENOFFICE = True OPENOFFICE = True
...@@ -195,8 +188,6 @@ class TestMimeMapper(HandlerTestCase): ...@@ -195,8 +188,6 @@ class TestMimeMapper(HandlerTestCase):
document_type_dict = self.mimemapper._document_type_dict document_type_dict = self.mimemapper._document_type_dict
type = document_type_dict.get("text") type = document_type_dict.get("text")
self.assertEqual(type, 'com.sun.star.text.TextDocument') self.assertEqual(type, 'com.sun.star.text.TextDocument')
type = document_type_dict.get("chart")
self.assertEqual(type, 'com.sun.star.chart2.ChartDocument')
type = document_type_dict.get("drawing") type = document_type_dict.get("drawing")
self.assertEqual(type, 'com.sun.star.drawing.DrawingDocument') self.assertEqual(type, 'com.sun.star.drawing.DrawingDocument')
type = document_type_dict.get("presentation") type = document_type_dict.get("presentation")
...@@ -210,87 +201,68 @@ class TestMimeMapper(HandlerTestCase): ...@@ -210,87 +201,68 @@ class TestMimeMapper(HandlerTestCase):
"""Test if function getAllowedExtensionList returns correctly a list with """Test if function getAllowedExtensionList returns correctly a list with
extensions that can generate with extension passed.""" extensions that can generate with extension passed."""
doc_got_list = list(self.mimemapper.getAllowedExtensionList('doc')) doc_got_list = list(self.mimemapper.getAllowedExtensionList('doc'))
_text_expected_tuple = text_expected_tuple + extra_text_expected_tuple
for arg in doc_got_list: for arg in doc_got_list:
self.assertTrue(arg in text_expected_tuple, self.assertIn(arg, _text_expected_tuple)
"%s not in %s" % (arg, text_expected_tuple))
jpeg_got_list = list(self.mimemapper.getAllowedExtensionList('jpeg')) jpeg_got_list = list(self.mimemapper.getAllowedExtensionList('jpeg'))
jpeg_expected_list = list(set(presentation_expected_tuple + jpeg_expected_list = list(set(presentation_expected_tuple +
drawing_expected_tuple)) drawing_expected_tuple))
for arg in jpeg_got_list: for arg in jpeg_got_list:
self.assertTrue(arg in jpeg_expected_list, self.assertIn(arg, jpeg_expected_list)
"%s not in %s" % (arg, jpeg_expected_list))
pdf_got_list = list(self.mimemapper.getAllowedExtensionList('pdf')) pdf_got_list = list(self.mimemapper.getAllowedExtensionList('pdf'))
pdf_expected_list = list(set(presentation_expected_tuple + pdf_expected_list = list(set(presentation_expected_tuple +
drawing_expected_tuple + web_expected_tuple + global_expected_tuple + drawing_expected_tuple + web_expected_tuple + global_expected_tuple +
math_expected_tuple + text_expected_tuple + spreadsheet_expected_tuple)) math_expected_tuple + _text_expected_tuple + spreadsheet_expected_tuple))
for arg in pdf_got_list: for arg in pdf_got_list:
self.assertTrue(arg in pdf_expected_list, self.assertIn(arg, pdf_expected_list)
"%s not in %s" % (arg, pdf_expected_list))
def testGetAllowedExtensionListForText(self): def testGetAllowedExtensionListForText(self):
"""Passing document_type equal to 'text', the return must be equal """Passing document_type equal to 'text', the return must be equal
to text_expected_tuple.""" to text_expected_tuple."""
got_list = list(self.mimemapper.getAllowedExtensionList(document_type='text')) self.assertEqual(
text_expected_list = list(text_expected_tuple) sorted(self.mimemapper.getAllowedExtensionList(document_type='text')),
for arg in got_list: sorted(text_expected_tuple + extra_text_expected_tuple)
self.assertTrue(arg in text_expected_list, )
"%s not in %s" % (arg, text_expected_list))
def testGetAllowedExtensionListForGlobal(self): def testGetAllowedExtensionListForGlobal(self):
"""Passing document_type equal to 'global', the return must be equal """Passing document_type equal to 'global', the return must be equal
to global_expected_tuple.""" to global_expected_tuple."""
got_list = list(self.mimemapper.getAllowedExtensionList(document_type='global')) self.assertEqual(
got_list.sort() sorted(self.mimemapper.getAllowedExtensionList(document_type='global')),
global_expected_list = list(global_expected_tuple) sorted(global_expected_tuple)
global_expected_list.sort() )
self.assertEqual(got_list, global_expected_list)
def testGetAllAllowedExtensionListForDrawing(self): def testGetAllAllowedExtensionListForDrawing(self):
"""Passing document_type equal to 'drawing', the return must be equal """Passing document_type equal to 'drawing', the return must be equal
to drawing_expected_tuple.""" to drawing_expected_tuple."""
got_list = list(self.mimemapper.getAllowedExtensionList(document_type='drawing')) self.assertEqual(
drawing_expected_list = list(drawing_expected_tuple) sorted(self.mimemapper.getAllowedExtensionList(document_type='drawing')),
drawing_expected_list.sort() sorted(drawing_expected_tuple)
for arg in got_list: )
self.assertTrue(arg in drawing_expected_list,
"%s not in %s" % (arg, drawing_expected_list))
def testGetAllAllowedExtensionListForWeb(self): def testGetAllAllowedExtensionListForWeb(self):
"""Passing document_type equal to 'web', the return must be equal """Passing document_type equal to 'web', the return must be equal
to web_expected_tuple.""" to web_expected_tuple."""
got_tuple = list(self.mimemapper.getAllowedExtensionList(document_type='web')) self.assertEqual(
got_tuple.sort() sorted(self.mimemapper.getAllowedExtensionList(document_type='web')),
web_expected_list = list(web_expected_tuple) sorted(web_expected_tuple)
web_expected_list.sort() )
self.assertEqual(got_tuple, web_expected_list)
def testGetAllAllowedExtensionListForPresentation(self): def testGetAllAllowedExtensionListForPresentation(self):
"""Passing document_type equal to 'presentation', the return must be equal """Passing document_type equal to 'presentation', the return must be equal
to presentation_expected_tuple.""" to presentation_expected_tuple."""
got_list = \ self.assertEqual(
list(self.mimemapper.getAllowedExtensionList(document_type='presentation')) sorted(self.mimemapper.getAllowedExtensionList(document_type='presentation')),
presentation_expected_list = list(presentation_expected_tuple) sorted(presentation_expected_tuple)
presentation_expected_list.sort() )
for arg in got_list:
self.assertTrue(arg in presentation_expected_list,
"%s not in %s" % (arg, presentation_expected_list))
def testGetAllAllowedExtensionListForSpreadsheet(self): def testGetAllAllowedExtensionListForSpreadsheet(self):
"""Passing document_type equal to 'spreadsheet', the return must be equal """Passing document_type equal to 'spreadsheet', the return must be equal
to spreadsheet_expected_tuple.""" to spreadsheet_expected_tuple."""
got_list = self.mimemapper.getAllowedExtensionList(document_type='spreadsheet') self.assertEqual(
for arg in got_list: sorted(self.mimemapper.getAllowedExtensionList(document_type='spreadsheet')),
self.assertTrue(arg in spreadsheet_expected_tuple, sorted(spreadsheet_expected_tuple)
"%s not in %s" % (arg, spreadsheet_expected_tuple)) )
def testGetAllAllowedExtensionListForChart(self):
"""Passing document_type equal to 'chart', the return must be equal
to chart_expected_tuple."""
got_list = list(self.mimemapper.getAllowedExtensionList(document_type='chart'))
got_list.sort()
chart_expected_list = list(chart_expected_tuple)
chart_expected_list.sort()
self.assertEqual(got_list, chart_expected_list)
def testGetFilterName(self): def testGetFilterName(self):
"""Test if passing extension and document_type, the filter is correct.""" """Test if passing extension and document_type, the filter is correct."""
......
...@@ -49,9 +49,14 @@ class TestAllowedExtensions(TestCase): ...@@ -49,9 +49,14 @@ class TestAllowedExtensions(TestCase):
ui_name. The request is by document type as text""" ui_name. The request is by document type as text"""
text_request = {'document_type': "text"} text_request = {'document_type': "text"}
text_allowed_list = self.proxy.getAllowedExtensionList(text_request) text_allowed_list = self.proxy.getAllowedExtensionList(text_request)
# XXX slightly different allowed formats with document_type !?
_text_expected_tuple = text_expected_tuple + (
('docm', 'Word 2007–365 VBA'),
('webp', 'WEBP - WebP Image'),
)
self.assertEqual( self.assertEqual(
sorted([tuple(x) for x in text_allowed_list]), sorted([tuple(x) for x in text_allowed_list]),
sorted(text_expected_tuple)) sorted(_text_expected_tuple))
def testGetAllowedPresentationExtensionListByType(self): def testGetAllowedPresentationExtensionListByType(self):
"""Verify if getAllowedExtensionList returns is a list with extension and """Verify if getAllowedExtensionList returns is a list with extension and
...@@ -59,14 +64,17 @@ class TestAllowedExtensions(TestCase): ...@@ -59,14 +64,17 @@ class TestAllowedExtensions(TestCase):
request_dict = {'document_type': "presentation"} request_dict = {'document_type': "presentation"}
presentation_allowed_list = self.proxy.getAllowedExtensionList(request_dict) presentation_allowed_list = self.proxy.getAllowedExtensionList(request_dict)
self.assertTrue(presentation_allowed_list) self.assertTrue(presentation_allowed_list)
for arg in presentation_allowed_list: self.assertEqual(
self.assertIn(tuple(arg), presentation_expected_tuple) sorted([tuple(x) for x in presentation_allowed_list]),
sorted(presentation_expected_tuple))
def testGetAllowedExtensionListByExtension(self): def testGetAllowedExtensionListByExtension(self):
"""Verify if getAllowedExtensionList returns is a list with extension and """Verify if getAllowedExtensionList returns is a list with extension and
ui_name. The request is by extension""" ui_name. The request is by extension"""
doc_allowed_list = self.proxy.getAllowedExtensionList({'extension': "doc"}) doc_allowed_list = self.proxy.getAllowedExtensionList({'extension': "doc"})
self.assertEqual(sorted([tuple(x) for x in doc_allowed_list]), sorted(text_expected_tuple)) self.assertEqual(
sorted([tuple(x) for x in doc_allowed_list]),
sorted(text_expected_tuple))
def testGetAllowedExtensionListByMimetype(self): def testGetAllowedExtensionListByMimetype(self):
"""Verify if getAllowedExtensionList returns is a list with extension and """Verify if getAllowedExtensionList returns is a list with extension and
......
...@@ -99,7 +99,7 @@ class TestUnoMimeMapper(HandlerTestCase): ...@@ -99,7 +99,7 @@ class TestUnoMimeMapper(HandlerTestCase):
def testWithoutOpenOffice(self): def testWithoutOpenOffice(self):
"""Test when the openoffice is stopped""" """Test when the openoffice is stopped"""
error_msg = "couldn\'t connect to socket (Success)\n" error_msg = "couldn\'t connect to socket"
hostname, host = openoffice.getAddress() hostname, host = openoffice.getAddress()
openoffice.stop() openoffice.stop()
python = path.join(self.office_binary_path, "python") python = path.join(self.office_binary_path, "python")
......
...@@ -80,9 +80,11 @@ def BBB_guess_extension(mimetype, title=None): ...@@ -80,9 +80,11 @@ def BBB_guess_extension(mimetype, title=None):
"Flat XML ODF Text Document": ".fodt", "Flat XML ODF Text Document": ".fodt",
"MET - OS/2 Metafile": ".met", "MET - OS/2 Metafile": ".met",
"Microsoft Excel 2007-2013 XML": ".ms.xlsx", "Microsoft Excel 2007-2013 XML": ".ms.xlsx",
"Excel 2007–365": ".ms.xlsx",
"Microsoft PowerPoint 2007-2013 XML": ".ms.pptx", "Microsoft PowerPoint 2007-2013 XML": ".ms.pptx",
"Microsoft PowerPoint 2007-2013 XML AutoPlay": ".ms.ppsx", "Microsoft PowerPoint 2007-2013 XML AutoPlay": ".ms.ppsx",
"Microsoft Word 2007-2013 XML": ".ms.docx", "Microsoft Word 2007-2013 XML": ".ms.docx",
"Word 2007–365": ".ms.docx",
}.get(title, None) or { }.get(title, None) or {
# mediatype : extension # mediatype : extension
"application/msword": ".doc", "application/msword": ".doc",
......
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