Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cloudooo
Commits
21af5fd2
Commit
21af5fd2
authored
Dec 09, 2016
by
Tristan Cavelier
Committed by
Cédric Le Ninivin
Dec 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add handler tests for getAllowedConversionFormat
parent
4b1f48f8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
597 additions
and
0 deletions
+597
-0
cloudooo/handler/ooo/tests/testOooHandler.py
cloudooo/handler/ooo/tests/testOooHandler.py
+554
-0
cloudooo/handler/pdf/tests/testPdfHandler.py
cloudooo/handler/pdf/tests/testPdfHandler.py
+13
-0
cloudooo/handler/wkhtmltopdf/tests/testWkhtmltopdfHandler.py
cloudooo/handler/wkhtmltopdf/tests/testWkhtmltopdfHandler.py
+12
-0
cloudooo/handler/x2t/tests/testX2tHandler.py
cloudooo/handler/x2t/tests/testX2tHandler.py
+18
-0
No files found.
cloudooo/handler/ooo/tests/testOooHandler.py
View file @
21af5fd2
...
...
@@ -187,6 +187,560 @@ class TestHandler(HandlerTestCase):
self
.
assertTrue
(
content_tree
.
xpath
(
'//text:variable-get[text() = "DISPLAY ME"]'
,
namespaces
=
content_tree
.
nsmap
))
def
testGetAllowedConversionFormatList_TextPlain
(
self
):
"""Test allowed conversion format for text/plain with charset parameter"""
def
get
(
*
args
,
**
kw
):
return
sorted
(
Handler
.
getAllowedConversionFormatList
(
*
args
,
**
kw
))
text_plain_output_list
=
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.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/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document (Writer)'
)]
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=US-ASCII;ignored=param"
),
text_plain_output_list
)
def
testGetAllowedConversionFormatList_ApplicationMsword
(
self
):
"""Test allowed conversion format for application/msword"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/msword;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.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/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document (Writer)'
),
(
'text/plain'
,
'Text - Choose Encoding'
)
])
def
testGetAllowedConversionFormatList_ApplicationPdf
(
self
):
"""Test allowed conversion format for application/pdf"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/pdf;ignored=param"
)),
[
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_TextRtf
(
self
):
"""Test allowed conversion format for text/rtf"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"text/rtf;ignored=param"
)),
[])
def
testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentText
(
self
):
"""Test allowed conversion format for application/vnd.oasis.opendocument.text"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.oasis.opendocument.text;ignored=param"
)),
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/rtf'
,
'Rich Text'
),
(
'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/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document (Writer)'
),
(
'text/plain'
,
'Text - Choose Encoding'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentTextFlatXml
(
self
):
"""Test allowed conversion format for application/vnd.oasis.opendocument.text-flat-xml"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.oasis.opendocument.text-flat-xml;ignored=param"
)),
[])
def
testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentWordprocessingmlDocument
(
self
):
"""Test allowed conversion format for application/vnd.openxmlformats-officedocument.wordprocessingml.document"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param"
)),
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/rtf'
,
'Rich Text'
),
(
'application/vnd.oasis.opendocument.text'
,
'ODF Text Document'
),
(
'application/vnd.oasis.opendocument.text-flat-xml'
,
'Flat XML ODF Text Document'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document (Writer)'
),
(
'text/plain'
,
'Text - Choose Encoding'
)
])
def
testGetAllowedConversionFormatList_ImageJpeg
(
self
):
"""Test allowed conversion format for image/jpeg"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/jpeg;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImagePng
(
self
):
"""Test allowed conversion format for image/png"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/png;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_TextHtml
(
self
):
"""Test allowed conversion format for text/html"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"text/html;ignored=param"
)),
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/rtf'
,
'Rich Text'
),
(
'application/vnd.ms-excel'
,
'Microsoft Excel 97-2003'
),
(
'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.text'
,
'ODF Text Document'
),
(
'application/vnd.oasis.opendocument.text'
,
'Text (Writer/Web)'
),
(
'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'
,
'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'
),
(
'application/vnd.sun.xml.writer'
,
'OpenOffice.org 1.0 Text Document (Writer/Web)'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'text/csv'
,
'Text CSV'
),
(
'text/plain'
,
'Text (Writer/Web)'
),
(
'text/plain'
,
'Text - Choose Encoding'
),
(
'text/plain'
,
'Text - Choose Encoding (Writer/Web)'
)
])
def
testGetAllowedConversionFormatList_ApplicationPostscript
(
self
):
"""Test allowed conversion format for application/postscript"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/postscript;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentGraphics
(
self
):
"""Test allowed conversion format for application/vnd.oasis.opendocument.graphics"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.oasis.opendocument.graphics;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageGif
(
self
):
"""Test allowed conversion format for image/gif"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/gif;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageSvgXml
(
self
):
"""Test allowed conversion format for image/svg+xml"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/svg+xml;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageTiff
(
self
):
"""Test allowed conversion format for image/tiff"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/tiff;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageXCmuRaster
(
self
):
"""Test allowed conversion format for image/x-cmu-raster"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-cmu-raster;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'image/tiff'
,
'TIFF - Tagged Image File Format'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageBmp
(
self
):
"""Test allowed conversion format for image/x-ms-bmp"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-ms-bmp;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'image/tiff'
,
'TIFF - Tagged Image File Format'
),
(
'image/x-cmu-raster'
,
'RAS - Sun Raster Image'
),
(
'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)'
)
])
def
testGetAllowedConversionFormatList_ImageXPortableBitmap
(
self
):
"""Test allowed conversion format for image/x-portable-bitmap"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-portable-bitmap;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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-graymap'
,
'PGM - Portable Graymap'
),
(
'image/x-portable-pixmap'
,
'PPM - Portable Pixelmap'
),
(
'image/x-xpixmap'
,
'XPM - X PixMap'
),
(
'text/html'
,
'HTML Document (Draw)'
)
])
def
testGetAllowedConversionFormatList_ImageXPortableGraymap
(
self
):
"""Test allowed conversion format for image/x-portable-graymap"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-portable-graymap;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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-pixmap'
,
'PPM - Portable Pixelmap'
),
(
'image/x-xpixmap'
,
'XPM - X PixMap'
),
(
'text/html'
,
'HTML Document (Draw)'
)
])
def
testGetAllowedConversionFormatList_ImageXPortablePixmap
(
self
):
"""Test allowed conversion format for image/x-portable-pixmap"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-portable-pixmap;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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-xpixmap'
,
'XPM - X PixMap'
),
(
'text/html'
,
'HTML Document (Draw)'
)
])
def
testGetAllowedConversionFormatList_ImageXXpixmap
(
self
):
"""Test allowed conversion format for image/x-xpixmap"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"image/x-xpixmap;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'application/vnd.oasis.opendocument.graphics'
,
'ODF Drawing'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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'
),
(
'text/html'
,
'HTML Document (Draw)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndMsExcel
(
self
):
"""Test allowed conversion format for application/vnd.ms-excel"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.ms-excel;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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'
,
'Office Open XML Spreadsheet'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'text/csv'
,
'Text CSV'
),
(
'text/html'
,
'HTML Document (Calc)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndMsExcelSheetMacroenabled12
(
self
):
"""Test allowed conversion format for application/vnd.ms-excel.sheet.macroEnabled.12"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.ms-excel.sheet.macroEnabled.12;ignored=param"
)),
[])
def
testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentSpreadsheet
(
self
):
"""Test allowed conversion format for application/vnd.oasis.opendocument.spreadsheet"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.oasis.opendocument.spreadsheet;ignored=param"
)),
[
(
'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.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'
),
(
'text/csv'
,
'Text CSV'
),
(
'text/html'
,
'HTML Document (Calc)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOpenXmlFormatsOfficedocumentSpreadsheetmlSheet
(
self
):
"""Test allowed conversion format for application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param"
)),
[
(
'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.oasis.opendocument.spreadsheet'
,
'ODF Spreadsheet'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'text/csv'
,
'Text CSV'
),
(
'text/html'
,
'HTML Document (Calc)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndSunXmlWriter
(
self
):
"""Test allowed conversion format for application/vnd.sun.xml.writer"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.sun.xml.writer;ignored=param"
)),
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.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/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document (Writer)'
),
(
'text/plain'
,
'Text - Choose Encoding'
)
])
def
testGetAllowedConversionFormatList_TextCsv
(
self
):
"""Test allowed conversion format for text/csv"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"text/csv;ignored=param"
)),
[
(
'application/msword'
,
'Microsoft Word 97-2003'
),
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/rtf'
,
'Rich Text'
),
(
'application/vnd.ms-excel'
,
'Microsoft Excel 97-2003'
),
(
'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.text'
,
'ODF Text Document'
),
(
'application/vnd.oasis.opendocument.text'
,
'Text (Writer/Web)'
),
(
'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'
,
'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'
),
(
'application/vnd.sun.xml.writer'
,
'OpenOffice.org 1.0 Text Document (Writer/Web)'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'text/html'
,
'HTML Document'
),
(
'text/html'
,
'HTML Document (Calc)'
),
(
'text/html'
,
'HTML Document (Writer)'
),
(
'text/plain'
,
'Text (Writer/Web)'
),
(
'text/plain'
,
'Text - Choose Encoding'
),
(
'text/plain'
,
'Text - Choose Encoding (Writer/Web)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOasisOpendocumentPresentation
(
self
):
"""Test allowed conversion format for application/vnd.oasis.opendocument.presentation"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.oasis.opendocument.presentation;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.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'
),
# TEST it
(
'application/vnd.openxmlformats-officedocument.presentationml.slideshow'
,
'Office Open XML Presentation AutoPlay'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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 (Impress)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation
(
self
):
"""Test allowed conversion format for application/vnd.openxmlformats-officedocument.presentationml.presentation"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.presentation'
,
'ODF 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/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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 (Impress)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndOpenxmlformatsOfficedocumentPresentationmlSlideshow
(
self
):
"""Test allowed conversion format for application/vnd.openxmlformats-officedocument.presentationml.slideshow"""
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.openxmlformats-officedocument.presentationml.slideshow;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'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.presentation'
,
'ODF Presentation'
),
(
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
,
'Microsoft PowerPoint 2007-2013 XML'
),
(
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
,
'Office Open XML Presentation'
),
(
'image/gif'
,
'GIF - Graphics Interchange Format'
),
(
'image/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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 (Impress)'
)
])
def
testGetAllowedConversionFormatList_ApplicationVndMsPowerpoint
(
self
):
"""Test allowed conversion format for application/vnd.ms-powerpoint"""
self
.
maxDiff
=
None
self
.
assertEquals
(
sorted
(
Handler
.
getAllowedConversionFormatList
(
"application/vnd.ms-powerpoint;ignored=param"
)),
[
(
'application/pdf'
,
'PDF - Portable Document Format'
),
(
'application/postscript'
,
'EPS - Encapsulated PostScript'
),
(
'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'
,
'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/jpeg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'image/png'
,
'PNG - Portable Network Graphic'
),
(
'image/svg+xml'
,
'SVG - Scalable Vector Graphics'
),
(
'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 (Impress)'
)
])
def
test_suite
():
return
make_suite
(
TestHandler
)
cloudooo/handler/pdf/tests/testPdfHandler.py
View file @
21af5fd2
...
...
@@ -64,6 +64,19 @@ class TestHandler(HandlerTestCase):
self
.
assertEquals
(
metadata
[
"title"
],
'Set Metadata Test'
)
self
.
assertEquals
(
metadata
[
'creator'
],
'gabriel
\
'
@'
)
def
testGetAllowedConversionFormatList
(
self
):
"""Test all combination of mimetype
None of the types below define any mimetype parameter to not ignore so far.
"""
get
=
Handler
.
getAllowedConversionFormatList
# Handled mimetypes
self
.
assertEquals
(
get
(
"application/pdf;ignored=param"
),
[(
"text/plain"
,
"Plain Text"
)])
# Unhandled mimetypes
self
.
assertEquals
(
get
(
"text/plain;ignored=param"
),
[])
self
.
assertEquals
(
get
(
"text/plain;charset=UTF-8;ignored=param"
),
[])
def
test_suite
():
return
make_suite
(
TestHandler
)
cloudooo/handler/wkhtmltopdf/tests/testWkhtmltopdfHandler.py
View file @
21af5fd2
...
...
@@ -77,6 +77,18 @@ class TestHandler(HandlerTestCase):
handler
=
Handler
(
self
.
tmp_url
,
""
,
"png"
,
**
self
.
kw
)
self
.
assertRaises
(
NotImplementedError
,
handler
.
setMetadata
)
def
testGetAllowedConversionFormatList
(
self
):
"""Test all combination of mimetype
None of the types below define any mimetype parameter to not ignore so far.
"""
get
=
Handler
.
getAllowedConversionFormatList
# Handled mimetypes
self
.
assertEquals
(
get
(
"text/html;ignored=param"
),
[(
"application/pdf"
,
"PDF - Portable Document Format"
)])
# Unhandled mimetypes
self
.
assertEquals
(
get
(
"application/pdf;ignored=param"
),
[])
def
test_suite
():
return
make_suite
(
TestHandler
)
cloudooo/handler/x2t/tests/testX2tHandler.py
View file @
21af5fd2
...
...
@@ -91,6 +91,24 @@ class TestHandler(HandlerTestCase):
handler
=
Handler
(
self
.
tmp_url
,
""
,
"xlsy"
,
**
self
.
kw
)
self
.
assertRaises
(
NotImplementedError
,
handler
.
setMetadata
)
def
testGetAllowedConversionFormatList
(
self
):
"""Test all combination of mimetype
None of the types below define any mimetype parameter to not ignore so far.
"""
get
=
Handler
.
getAllowedConversionFormatList
self
.
assertEquals
(
get
(
"application/x-asc-text;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)])
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)])
self
.
assertEquals
(
get
(
"application/x-asc-presentation;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param"
),
[(
"application/x-asc-text"
,
"OnlyOffice Text Document"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param"
),
[(
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param"
),
[(
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
)])
def
test_suite
():
return
make_suite
(
TestHandler
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment