Commit 8586bc3e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

cosmetic changes only.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42443 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fe381b52
...@@ -31,50 +31,55 @@ from cloudooo.handler.ooo.application.openoffice import openoffice ...@@ -31,50 +31,55 @@ from cloudooo.handler.ooo.application.openoffice import openoffice
from cloudooo.handler.ooo.mimemapper import MimeMapper from cloudooo.handler.ooo.mimemapper import MimeMapper
from cloudoooTestCase import make_suite from cloudoooTestCase import make_suite
text_expected_tuple = (('doc', 'Microsoft Word 6.0'), text_expected_tuple = (
('doc', 'Microsoft Word 6.0'),
('doc', 'Microsoft Word 95'), ('doc', 'Microsoft Word 95'),
('doc', 'Microsoft Word 97/2000/XP'), ('doc', 'Microsoft Word 97/2000/XP'),
('htm', 'HTML Document (OpenOffice.org Writer)'), ('htm', 'HTML Document (OpenOffice.org Writer)'),
('html', 'HTML Document (OpenOffice.org Writer)'), ('html', 'HTML Document (OpenOffice.org Writer)'),
('html', 'XHTML'), ('html', 'XHTML'),
('odt', 'ODF Text Document'), ('odt', 'ODF Text Document'),
('ott', 'ODF Text Document Template'), ('ott', 'ODF Text Document Template'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('rtf', 'Rich Text Format'), ('rtf', 'Rich Text Format'),
('sdw', 'StarWriter 3.0'), ('sdw', 'StarWriter 3.0'),
('sdw', 'StarWriter 4.0'), ('sdw', 'StarWriter 4.0'),
('sdw', 'StarWriter 5.0'), ('sdw', 'StarWriter 5.0'),
('sxw', 'OpenOffice.org 1.0 Text Document'), ('sxw', 'OpenOffice.org 1.0 Text Document'),
('txt', 'Text Encoded'),
('txt', 'Text'), ('txt', 'Text'),
('txt', 'Text Encoded'),
('xhtml', 'XHTML'), ('xhtml', 'XHTML'),
(u'pdb', u'AportisDoc (Palm)'), ('pdb', 'AportisDoc (Palm)'),
(u'psw', u'Pocket Word')) ('psw', 'Pocket Word'),
)
global_expected_tuple = (('sdw', 'StarWriter 3.0'), global_expected_tuple = (
('htm', 'HTML (Writer/Global)'),
('html', 'HTML (Writer/Global)'),
('odm', 'ODF Master Document'),
('odt', 'ODF Text Document'),
('pdf', 'PDF - Portable Document Format'),
('sdw', 'StarWriter 3.0'),
('sdw', 'StarWriter 4.0'), ('sdw', 'StarWriter 4.0'),
('sdw', 'StarWriter 5.0'), ('sdw', 'StarWriter 5.0'),
('txt', 'Text Encoded (OpenOffice.org Master Document)'),
('sxw', 'OpenOffice.org 1.0 Text Document'),
('sxg', 'OpenOffice.org 1.0 Master Document'), ('sxg', 'OpenOffice.org 1.0 Master Document'),
('pdf', 'PDF - Portable Document Format'), ('sxw', 'OpenOffice.org 1.0 Text Document'),
('odm', 'ODF Master Document'), ('txt', 'Text Encoded (OpenOffice.org Master Document)'),
('odt', 'ODF Text Document'), )
('html', 'HTML (Writer/Global)'),
('htm', 'HTML (Writer/Global)'))
drawing_expected_tuple = (('bmp', 'BMP - Windows Bitmap'), drawing_expected_tuple = (
('emf', 'EMF - Enhanced Metafile'), ('bmp', 'BMP - Windows Bitmap'),
('emf', 'EMF - Enhanced Metafile'),
('eps', 'EPS - Encapsulated PostScript'), ('eps', 'EPS - Encapsulated PostScript'),
('gif', 'GIF - Graphics Interchange Format'), ('gif', 'GIF - Graphics Interchange Format'),
('htm', 'HTML Document (OpenOffice.org Draw)'), ('htm', 'HTML Document (OpenOffice.org Draw)'),
('html', 'HTML Document (OpenOffice.org Draw)'), ('html', 'HTML Document (OpenOffice.org Draw)'),
('html', 'XHTML'), ('html', 'XHTML'),
('jfif', 'JPEG - Joint Photographic Experts Group'), ('jfif', 'JPEG - Joint Photographic Experts Group'),
('jif', 'JPEG - Joint Photographic Experts Group'), ('jif', 'JPEG - Joint Photographic Experts Group'),
('jpe', 'JPEG - Joint Photographic Experts Group'), ('jpe', 'JPEG - Joint Photographic Experts Group'),
('jpeg', 'JPEG - Joint Photographic Experts Group'), ('jpeg', 'JPEG - Joint Photographic Experts Group'),
('jpg', 'JPEG - Joint Photographic Experts Group'), ('jpg', 'JPEG - Joint Photographic Experts Group'),
('met', 'MET - OS/2 Metafile'), ('met', 'MET - OS/2 Metafile'),
('odg', 'ODF Drawing'), ('odg', 'ODF Drawing'),
('otg', 'ODF Drawing Template'), ('otg', 'ODF Drawing Template'),
...@@ -87,27 +92,31 @@ drawing_expected_tuple = (('bmp', 'BMP - Windows Bitmap'), ...@@ -87,27 +92,31 @@ drawing_expected_tuple = (('bmp', 'BMP - Windows Bitmap'),
('ppm', 'PPM - Portable Pixelmap'), ('ppm', 'PPM - Portable Pixelmap'),
('ras', 'RAS - Sun Raster Image'), ('ras', 'RAS - Sun Raster Image'),
('sda', 'StarDraw 5.0'), ('sda', 'StarDraw 5.0'),
('sdd', 'StarDraw 3.0'), ('sdd', 'StarDraw 3.0'),
('svg', 'SVG - Scalable Vector Graphics'), ('svg', 'SVG - Scalable Vector Graphics'),
('svm', 'SVM - StarView Metafile'), ('svm', 'SVM - StarView Metafile'),
('sxd', 'OpenOffice.org 1.0 Drawing'), ('sxd', 'OpenOffice.org 1.0 Drawing'),
('tif', 'TIFF - Tagged Image File Format'), ('tif', 'TIFF - Tagged Image File Format'),
('tiff', 'TIFF - Tagged Image File Format'), ('tiff', 'TIFF - Tagged Image File Format'),
('wmf', 'WMF - Windows Metafile'), ('wmf', 'WMF - Windows Metafile'),
('xhtml', 'XHTML'), ('xpm', 'XPM - X PixMap')) ('xhtml', 'XHTML'), ('xpm', 'XPM - X PixMap'),
)
web_expected_tuple = (('html', 'HTML Document'), web_expected_tuple = (
('htm', 'HTML Document'), ('htm', 'HTML Document'),
('txt', 'Text (OpenOffice.org Writer/Web)'), ('html', 'HTML Document'),
('txt', 'Text Encoded (OpenOffice.org Writer/Web)'),
('sxw', 'OpenOffice.org 1.0 Text Document (OpenOffice.org Writer/Web)'),
('pdf', 'PDF - Portable Document Format'),
('odt', 'OpenOffice.org Text (OpenOffice.org Writer/Web)'), ('odt', 'OpenOffice.org Text (OpenOffice.org Writer/Web)'),
('pdf', 'PDF - Portable Document Format'),
('sdw', 'StarWriter 3.0 (OpenOffice.org Writer/Web)'), ('sdw', 'StarWriter 3.0 (OpenOffice.org Writer/Web)'),
('sdw', 'StarWriter 4.0 (OpenOffice.org Writer/Web)'), ('sdw', 'StarWriter 4.0 (OpenOffice.org Writer/Web)'),
('sdw', 'StarWriter 5.0 (OpenOffice.org Writer/Web)')) ('sdw', 'StarWriter 5.0 (OpenOffice.org Writer/Web)'),
('sxw', 'OpenOffice.org 1.0 Text Document (OpenOffice.org Writer/Web)'),
('txt', 'Text (OpenOffice.org Writer/Web)'),
('txt', 'Text Encoded (OpenOffice.org Writer/Web)'),
)
presentation_expected_tuple = (('bmp', 'BMP - Windows Bitmap'), presentation_expected_tuple = (
('bmp', 'BMP - Windows Bitmap'),
('emf', 'EMF - Enhanced Metafile'), ('emf', 'EMF - Enhanced Metafile'),
('eps', 'EPS - Encapsulated PostScript'), ('eps', 'EPS - Encapsulated PostScript'),
('gif', 'GIF - Graphics Interchange Format'), ('gif', 'GIF - Graphics Interchange Format'),
...@@ -126,7 +135,7 @@ presentation_expected_tuple = (('bmp', 'BMP - Windows Bitmap'), ...@@ -126,7 +135,7 @@ presentation_expected_tuple = (('bmp', 'BMP - Windows Bitmap'),
('pbm', 'PBM - Portable Bitmap'), ('pbm', 'PBM - Portable Bitmap'),
('pct', 'PCT - Mac Pict'), ('pct', 'PCT - Mac Pict'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('pgm', 'PGM - Portable Graymap'), ('pgm', 'PGM - Portable Graymap'),
('pict', 'PCT - Mac Pict'), ('pict', 'PCT - Mac Pict'),
('png', 'PNG - Portable Network Graphic'), ('png', 'PNG - Portable Network Graphic'),
('pot', 'Microsoft PowerPoint 97/2000/XP Template'), ('pot', 'Microsoft PowerPoint 97/2000/XP Template'),
...@@ -141,18 +150,20 @@ presentation_expected_tuple = (('bmp', 'BMP - Windows Bitmap'), ...@@ -141,18 +150,20 @@ presentation_expected_tuple = (('bmp', 'BMP - Windows Bitmap'),
('svm', 'SVM - StarView Metafile'), ('svm', 'SVM - StarView Metafile'),
('sxd', 'OpenOffice.org 1.0 Drawing (OpenOffice.org Impress)'), ('sxd', 'OpenOffice.org 1.0 Drawing (OpenOffice.org Impress)'),
('sxi', 'OpenOffice.org 1.0 Presentation'), ('sxi', 'OpenOffice.org 1.0 Presentation'),
('tif', 'TIFF - Tagged Image File Format'), ('tif', 'TIFF - Tagged Image File Format'),
('tiff', 'TIFF - Tagged Image File Format'), ('tiff', 'TIFF - Tagged Image File Format'),
('wmf', 'WMF - Windows Metafile'), ('wmf', 'WMF - Windows Metafile'),
('xhtml', 'XHTML'), ('xhtml', 'XHTML'),
('xpm', 'XPM - X PixMap')) ('xpm', 'XPM - X PixMap'),
)
spreadsheet_expected_list = (('csv', 'Text CSV'), spreadsheet_expected_list = (
('csv', 'Text CSV'),
('htm', 'HTML Document (OpenOffice.org Calc)'), ('htm', 'HTML Document (OpenOffice.org Calc)'),
('html', 'HTML Document (OpenOffice.org Calc)'), ('html', 'HTML Document (OpenOffice.org Calc)'),
('html', 'XHTML'), ('html', 'XHTML'),
('ods', 'ODF Spreadsheet'), ('ods', 'ODF Spreadsheet'),
('ots', 'ODF Spreadsheet Template'), ('ots', 'ODF Spreadsheet Template'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('sdc', 'StarCalc 3.0'), ('sdc', 'StarCalc 3.0'),
('sdc', 'StarCalc 4.0'), ('sdc', 'StarCalc 4.0'),
...@@ -179,21 +190,26 @@ spreadsheet_expected_list = (('csv', 'Text CSV'), ...@@ -179,21 +190,26 @@ spreadsheet_expected_list = (('csv', 'Text CSV'),
('xlw', 'Microsoft Excel 4.0'), ('xlw', 'Microsoft Excel 4.0'),
('xlw', 'Microsoft Excel 5.0'), ('xlw', 'Microsoft Excel 5.0'),
('xlw', 'Microsoft Excel 95'), ('xlw', 'Microsoft Excel 95'),
('xlw', 'Microsoft Excel 97/2000/XP')) ('xlw', 'Microsoft Excel 97/2000/XP'),
)
math_expected_tuple = (('smf', 'StarMath 4.0'), math_expected_tuple = (
('mml', 'MathML 1.01'), ('mml', 'MathML 1.01'),
('odf', 'ODF Formula'),
('pdf', 'PDF - Portable Document Format'), ('pdf', 'PDF - Portable Document Format'),
('smf', 'StarMath 3.0'),
('smf', 'StarMath 4.0'),
('smf', 'StarMath 5.0'), ('smf', 'StarMath 5.0'),
('sxm', 'OpenOffice.org 1.0 Formula'), ('sxm', 'OpenOffice.org 1.0 Formula'),
('odf', 'ODF Formula'), )
('smf', 'StarMath 3.0'))
chart_expected_tuple = (('sds', 'StarChart 3.0'), chart_expected_tuple = (
('odc', 'ODF Chart'),
('sds', 'StarChart 3.0'),
('sds', 'StarChart 4.0'), ('sds', 'StarChart 4.0'),
('sds', 'StarChart 5.0'), ('sds', 'StarChart 5.0'),
('sxs', 'OpenOffice.org 1.0 Chart'), ('sxs', 'OpenOffice.org 1.0 Chart'),
('odc', 'ODF Chart')) )
OPENOFFICE = True OPENOFFICE = True
...@@ -214,7 +230,7 @@ class TestMimeMapper(CloudoooTestCase): ...@@ -214,7 +230,7 @@ class TestMimeMapper(CloudoooTestCase):
"""Test the case that the user passes extension which does not exist.""" """Test the case that the user passes extension which does not exist."""
empty_list = self.mimemapper.getFilterList('xxx') empty_list = self.mimemapper.getFilterList('xxx')
self.assertEquals(empty_list, []) self.assertEquals(empty_list, [])
def testIfThereIsDuplicateData(self): def testIfThereIsDuplicateData(self):
"""Test if there is duplicate data.""" """Test if there is duplicate data."""
# XXX It can not exists multiple keys inside a dictionary # XXX It can not exists multiple keys inside a dictionary
...@@ -259,21 +275,21 @@ class TestMimeMapper(CloudoooTestCase): ...@@ -259,21 +275,21 @@ class TestMimeMapper(CloudoooTestCase):
self.assertEquals(type, 'com.sun.star.text.WebDocument') self.assertEquals(type, 'com.sun.star.text.WebDocument')
def testGetAllowedExtensionListByExtension(self): def testGetAllowedExtensionListByExtension(self):
"""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'))
for arg in doc_got_list: for arg in doc_got_list:
self.assertTrue(arg in text_expected_tuple, self.assertTrue(arg in text_expected_tuple,
"%s not in %s" % (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.assertTrue(arg in jpeg_expected_list,
"%s not in %s" % (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_list)) math_expected_tuple + text_expected_tuple + spreadsheet_expected_list))
for arg in pdf_got_list: for arg in pdf_got_list:
self.assertTrue(arg in pdf_expected_list, self.assertTrue(arg in pdf_expected_list,
...@@ -304,7 +320,7 @@ class TestMimeMapper(CloudoooTestCase): ...@@ -304,7 +320,7 @@ class TestMimeMapper(CloudoooTestCase):
drawing_expected_list = list(drawing_expected_tuple) drawing_expected_list = list(drawing_expected_tuple)
drawing_expected_list.sort() drawing_expected_list.sort()
for arg in got_list: for arg in got_list:
self.assertTrue(arg in drawing_expected_list, self.assertTrue(arg in drawing_expected_list,
"%s not in %s" % (arg, drawing_expected_list)) "%s not in %s" % (arg, drawing_expected_list))
def testGetAllAllowedExtensionListForWeb(self): def testGetAllAllowedExtensionListForWeb(self):
...@@ -324,7 +340,7 @@ class TestMimeMapper(CloudoooTestCase): ...@@ -324,7 +340,7 @@ class TestMimeMapper(CloudoooTestCase):
presentation_expected_list = list(presentation_expected_tuple) presentation_expected_list = list(presentation_expected_tuple)
presentation_expected_list.sort() presentation_expected_list.sort()
for arg in got_list: for arg in got_list:
self.assertTrue(arg in presentation_expected_list, self.assertTrue(arg in presentation_expected_list,
"%s not in %s" % (arg, presentation_expected_list)) "%s not in %s" % (arg, presentation_expected_list))
def testGetAllAllowedExtensionListForSpreadsheet(self): def testGetAllAllowedExtensionListForSpreadsheet(self):
...@@ -332,7 +348,7 @@ class TestMimeMapper(CloudoooTestCase): ...@@ -332,7 +348,7 @@ class TestMimeMapper(CloudoooTestCase):
to spreadsheet_expected_list.""" to spreadsheet_expected_list."""
got_list = self.mimemapper.getAllowedExtensionList(document_type='spreadsheet') got_list = self.mimemapper.getAllowedExtensionList(document_type='spreadsheet')
for arg in got_list: for arg in got_list:
self.assertTrue(arg in spreadsheet_expected_list, self.assertTrue(arg in spreadsheet_expected_list,
"%s not in %s" % (arg, spreadsheet_expected_list)) "%s not in %s" % (arg, spreadsheet_expected_list))
def testGetAllAllowedExtensionListForChart(self): def testGetAllAllowedExtensionListForChart(self):
......
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