Commit 21af5fd2 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Cédric Le Ninivin

add handler tests for getAllowedConversionFormat

parent 4b1f48f8
......@@ -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)
......@@ -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)
......@@ -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)
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