Commit 5e2b3945 authored by Tristan Cavelier's avatar Tristan Cavelier

ooo: fix backward compatibily + update test

also update test for unhandled libreoffice 5.2 formats
parent d5421ec7
...@@ -241,7 +241,7 @@ class Handler(object): ...@@ -241,7 +241,7 @@ class Handler(object):
continue continue
if ext: if ext:
mimetype, _ = mimetypes.guess_type("a." + ext) # XXX never guess mimetype, _ = mimetypes.guess_type("a." + ext) # XXX never guess
if mimetype and mimetype != parsed_mimetype_type: if mimetype:
output_set.add((mimetype, title)) output_set.add((mimetype, title))
return list(output_set) return list(output_set)
......
...@@ -201,7 +201,8 @@ class TestHandler(HandlerTestCase): ...@@ -201,7 +201,8 @@ class TestHandler(HandlerTestCase):
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'),
('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 Graphic'),
('text/html', 'HTML Document (Writer)')] ('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text - Choose Encoding')]
self.assertEquals(get("text/plain;ignored=param"), text_plain_output_list) self.assertEquals(get("text/plain;ignored=param"), text_plain_output_list)
self.assertEquals(get("text/plain;charset=UTF-8;ignored=param"), text_plain_output_list) self.assertEquals(get("text/plain;charset=UTF-8;ignored=param"), text_plain_output_list)
self.assertEquals(get("text/plain;charset=US-ASCII;ignored=param"), text_plain_output_list) self.assertEquals(get("text/plain;charset=US-ASCII;ignored=param"), text_plain_output_list)
...@@ -210,7 +211,8 @@ class TestHandler(HandlerTestCase): ...@@ -210,7 +211,8 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for application/msword""" """Test allowed conversion format for application/msword"""
self.assertEquals( self.assertEquals(
sorted(Handler.getAllowedConversionFormatList("application/msword;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/msword;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/msword', 'Microsoft Word 97-2003'),
('application/pdf', 'PDF - Portable Document Format'),
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('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'),
...@@ -225,19 +227,15 @@ class TestHandler(HandlerTestCase): ...@@ -225,19 +227,15 @@ class TestHandler(HandlerTestCase):
"""Test allowed conversion format for application/pdf""" """Test allowed conversion format for application/pdf"""
self.assertEquals( self.assertEquals(
sorted(Handler.getAllowedConversionFormatList("application/pdf;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/pdf;ignored=param")),
[ ('application/postscript', 'EPS - Encapsulated PostScript'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('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 Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_TextRtf(self): def testGetAllowedConversionFormatList_TextRtf(self):
...@@ -253,6 +251,7 @@ class TestHandler(HandlerTestCase): ...@@ -253,6 +251,7 @@ class TestHandler(HandlerTestCase):
[ ('application/msword', 'Microsoft Word 97-2003'), [ ('application/msword', 'Microsoft 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.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', 'Microsoft Word 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'), ('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Office Open XML Text'),
...@@ -276,6 +275,8 @@ class TestHandler(HandlerTestCase): ...@@ -276,6 +275,8 @@ class TestHandler(HandlerTestCase):
('application/rtf', 'Rich Text'), ('application/rtf', 'Rich Text'),
('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'),
('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 Graphic'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
...@@ -289,15 +290,11 @@ class TestHandler(HandlerTestCase): ...@@ -289,15 +290,11 @@ class TestHandler(HandlerTestCase):
('application/postscript', 'EPS - Encapsulated PostScript'), ('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
('image/jpeg', 'JPEG - Joint Photographic Experts Group'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImagePng(self): def testGetAllowedConversionFormatList_ImagePng(self):
...@@ -309,14 +306,10 @@ class TestHandler(HandlerTestCase): ...@@ -309,14 +306,10 @@ class TestHandler(HandlerTestCase):
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('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/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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_TextHtml(self): def testGetAllowedConversionFormatList_TextHtml(self):
...@@ -340,6 +333,9 @@ class TestHandler(HandlerTestCase): ...@@ -340,6 +333,9 @@ class TestHandler(HandlerTestCase):
('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 Graphic'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document'),
('text/html', 'HTML Document (Calc)'),
('text/html', 'HTML Document (Writer)'),
('text/plain', 'Text (Writer/Web)'), ('text/plain', 'Text (Writer/Web)'),
('text/plain', 'Text - Choose Encoding'), ('text/plain', 'Text - Choose Encoding'),
('text/plain', 'Text - Choose Encoding (Writer/Web)') ]) ('text/plain', 'Text - Choose Encoding (Writer/Web)') ])
...@@ -349,18 +345,14 @@ class TestHandler(HandlerTestCase): ...@@ -349,18 +345,14 @@ class TestHandler(HandlerTestCase):
self.assertEquals( self.assertEquals(
sorted(Handler.getAllowedConversionFormatList("application/postscript;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/postscript;ignored=param")),
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/postscript', 'EPS - Encapsulated PostScript'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing'),
('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 Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentGraphics(self): def testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentGraphics(self):
...@@ -369,17 +361,13 @@ class TestHandler(HandlerTestCase): ...@@ -369,17 +361,13 @@ class TestHandler(HandlerTestCase):
sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.graphics;ignored=param")), sorted(Handler.getAllowedConversionFormatList("application/vnd.oasis.opendocument.graphics;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'),
('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 Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageGif(self): def testGetAllowedConversionFormatList_ImageGif(self):
...@@ -389,16 +377,12 @@ class TestHandler(HandlerTestCase): ...@@ -389,16 +377,12 @@ 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'),
('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 Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageSvgXml(self): def testGetAllowedConversionFormatList_ImageSvgXml(self):
...@@ -411,13 +395,9 @@ class TestHandler(HandlerTestCase): ...@@ -411,13 +395,9 @@ class TestHandler(HandlerTestCase):
('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 Graphic'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/tiff', 'TIFF - Tagged Image File Format'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageTiff(self): def testGetAllowedConversionFormatList_ImageTiff(self):
...@@ -431,12 +411,8 @@ class TestHandler(HandlerTestCase): ...@@ -431,12 +411,8 @@ class TestHandler(HandlerTestCase):
('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 Graphic'),
('image/svg+xml', 'SVG - Scalable Vector Graphics'), ('image/svg+xml', 'SVG - Scalable Vector Graphics'),
('image/x-cmu-raster', 'RAS - Sun Raster Image'), ('image/tiff', 'TIFF - Tagged Image File Format'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageXCmuRaster(self): def testGetAllowedConversionFormatList_ImageXCmuRaster(self):
...@@ -452,10 +428,6 @@ class TestHandler(HandlerTestCase): ...@@ -452,10 +428,6 @@ class TestHandler(HandlerTestCase):
('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/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageBmp(self): def testGetAllowedConversionFormatList_ImageBmp(self):
...@@ -470,11 +442,7 @@ class TestHandler(HandlerTestCase): ...@@ -470,11 +442,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageXPortableBitmap(self): def testGetAllowedConversionFormatList_ImageXPortableBitmap(self):
...@@ -489,11 +457,7 @@ class TestHandler(HandlerTestCase): ...@@ -489,11 +457,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageXPortableGraymap(self): def testGetAllowedConversionFormatList_ImageXPortableGraymap(self):
...@@ -508,11 +472,7 @@ class TestHandler(HandlerTestCase): ...@@ -508,11 +472,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageXPortablePixmap(self): def testGetAllowedConversionFormatList_ImageXPortablePixmap(self):
...@@ -527,11 +487,7 @@ class TestHandler(HandlerTestCase): ...@@ -527,11 +487,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ImageXXpixmap(self): def testGetAllowedConversionFormatList_ImageXXpixmap(self):
...@@ -546,11 +502,7 @@ class TestHandler(HandlerTestCase): ...@@ -546,11 +502,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('text/html', 'HTML Document (Draw)') ]) ('text/html', 'HTML Document (Draw)') ])
def testGetAllowedConversionFormatList_ApplicationVndMsExcel(self): def testGetAllowedConversionFormatList_ApplicationVndMsExcel(self):
...@@ -558,6 +510,7 @@ class TestHandler(HandlerTestCase): ...@@ -558,6 +510,7 @@ class TestHandler(HandlerTestCase):
self.assertEquals( self.assertEquals(
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.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'),
...@@ -579,6 +532,7 @@ class TestHandler(HandlerTestCase): ...@@ -579,6 +532,7 @@ class TestHandler(HandlerTestCase):
[ ('application/pdf', 'PDF - Portable Document Format'), [ ('application/pdf', 'PDF - Portable Document Format'),
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Microsoft Excel 97-2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'),
('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/png', 'PNG - Portable Network Graphic'),
...@@ -593,6 +547,8 @@ class TestHandler(HandlerTestCase): ...@@ -593,6 +547,8 @@ class TestHandler(HandlerTestCase):
('application/vnd.ms-excel', 'Microsoft Excel 97-2003'), ('application/vnd.ms-excel', 'Microsoft Excel 97-2003'),
('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'), ('application/vnd.ms-excel.sheet.macroEnabled.12', 'Microsoft Excel 2007-2016 XML (macro enabled)'),
('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'), ('application/vnd.oasis.opendocument.spreadsheet', 'ODF Spreadsheet'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Microsoft Excel 2007-2013 XML'),
('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Office Open XML Spreadsheet'),
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('text/csv', 'Text CSV'), ('text/csv', 'Text CSV'),
('text/html', 'HTML Document (Calc)') ]) ('text/html', 'HTML Document (Calc)') ])
...@@ -633,6 +589,7 @@ class TestHandler(HandlerTestCase): ...@@ -633,6 +589,7 @@ class TestHandler(HandlerTestCase):
('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 Graphic'),
('text/csv', 'Text CSV'),
('text/html', 'HTML Document'), ('text/html', 'HTML Document'),
('text/html', 'HTML Document (Calc)'), ('text/html', 'HTML Document (Calc)'),
('text/html', 'HTML Document (Writer)'), ('text/html', 'HTML Document (Writer)'),
...@@ -649,6 +606,7 @@ class TestHandler(HandlerTestCase): ...@@ -649,6 +606,7 @@ class TestHandler(HandlerTestCase):
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'), ('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003'),
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'), ('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.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), # TEST it
...@@ -658,12 +616,7 @@ class TestHandler(HandlerTestCase): ...@@ -658,12 +616,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
def testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation(self): def testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation(self):
...@@ -676,6 +629,8 @@ class TestHandler(HandlerTestCase): ...@@ -676,6 +629,8 @@ class TestHandler(HandlerTestCase):
('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'), ('application/vnd.ms-powerpoint', 'Microsoft PowerPoint 97-2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', '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.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Microsoft PowerPoint 2007-2013 XML AutoPlay'),
('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'), ('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Office Open XML Presentation AutoPlay'),
('image/gif', 'GIF - Graphics Interchange Format'), ('image/gif', 'GIF - Graphics Interchange Format'),
...@@ -683,12 +638,7 @@ class TestHandler(HandlerTestCase): ...@@ -683,12 +638,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
def testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlSlideshow(self): def testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlSlideshow(self):
...@@ -703,26 +653,24 @@ class TestHandler(HandlerTestCase): ...@@ -703,26 +653,24 @@ class TestHandler(HandlerTestCase):
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'), ('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.slideshow', 'Office Open XML Presentation AutoPlay'),
('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 Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
def testGetAllowedConversionFormatList_ApplicationVndMsPowerpoint(self): def testGetAllowedConversionFormatList_ApplicationVndMsPowerpoint(self):
"""Test allowed conversion format for application/vnd.ms-powerpoint""" """Test allowed conversion format for application/vnd.ms-powerpoint"""
self.maxDiff = None
self.assertEquals( self.assertEquals(
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', 'Microsoft PowerPoint 97-2003 AutoPlay'),
('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'), ('application/vnd.oasis.opendocument.graphics', 'ODF Drawing (Impress)'),
('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'), ('application/vnd.oasis.opendocument.presentation', 'ODF Presentation'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'), ('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Microsoft PowerPoint 2007-2013 XML'),
...@@ -734,12 +682,7 @@ class TestHandler(HandlerTestCase): ...@@ -734,12 +682,7 @@ class TestHandler(HandlerTestCase):
('image/png', 'PNG - Portable Network Graphic'), ('image/png', 'PNG - Portable Network Graphic'),
('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/x-cmu-raster', 'RAS - Sun Raster Image'),
('image/x-ms-bmp', 'BMP - Windows Bitmap'), ('image/x-ms-bmp', 'BMP - Windows Bitmap'),
('image/x-portable-bitmap', 'PBM - Portable Bitmap'),
('image/x-portable-graymap', 'PGM - Portable Graymap'),
('image/x-portable-pixmap', 'PPM - Portable Pixelmap'),
('image/x-xpixmap', 'XPM - X PixMap'),
('text/html', 'HTML Document (Impress)') ]) ('text/html', 'HTML Document (Impress)') ])
def test_suite(): def test_suite():
......
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