Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
cloudooo
Commits
fc7346d0
Commit
fc7346d0
authored
Feb 04, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests and mimemapper.py for LibreOffice 4.2.
parent
056a2158
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
143 deletions
+51
-143
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+4
-0
cloudooo/handler/ooo/tests/testOooMimemapper.py
cloudooo/handler/ooo/tests/testOooMimemapper.py
+22
-50
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+25
-93
No files found.
cloudooo/handler/ooo/mimemapper.py
View file @
fc7346d0
...
@@ -99,11 +99,15 @@ class MimeMapper(object):
...
@@ -99,11 +99,15 @@ class MimeMapper(object):
"""
"""
alternative_extension_dict
=
{
alternative_extension_dict
=
{
'Microsoft Excel 2007/2010 XML'
:
'ms.xlsx'
,
'Microsoft Excel 2007/2010 XML'
:
'ms.xlsx'
,
'Microsoft Excel 2007/2010/2013 XML'
:
'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/2010 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010 XML'
:
'ms.pptx'
,
'Microsoft PowerPoint 2007/2010 XML'
:
'ms.pptx'
,
'Microsoft PowerPoint 2007/2010/2013 XML'
:
'ms.pptx'
,
'Microsoft Word 2007/2010 XML'
:
'ms.docx'
,
'Microsoft Word 2007/2010 XML'
:
'ms.docx'
,
'Microsoft Word 2007/2010/2013 XML'
:
'ms.docx'
,
'Microsoft Word 6.0'
:
'6.doc'
,
'Microsoft Word 6.0'
:
'6.doc'
,
'Microsoft Word 95'
:
'95.doc'
,
'Microsoft Word 95'
:
'95.doc'
,
}
}
...
...
cloudooo/handler/ooo/tests/testOooMimemapper.py
View file @
fc7346d0
...
@@ -31,26 +31,17 @@ from cloudooo.handler.ooo.application.openoffice import openoffice
...
@@ -31,26 +31,17 @@ from cloudooo.handler.ooo.application.openoffice import openoffice
from
cloudooo.handler.ooo.mimemapper
import
MimeMapper
from
cloudooo.handler.ooo.mimemapper
import
MimeMapper
text_expected_tuple
=
(
text_expected_tuple
=
(
(
'doc'
,
'Microsoft Word 6.0'
),
(
'doc'
,
'Microsoft Word 95'
),
(
'doc'
,
'Microsoft Word 97/2000/XP/2003'
),
(
'doc'
,
'Microsoft Word 97/2000/XP/2003'
),
(
'docx'
,
'Microsoft Word 2007 XML'
),
(
'docx'
,
'Microsoft Word 2007
/2010/2013
XML'
),
(
'docx'
,
'Office Open XML Text'
),
(
'docx'
,
'Office Open XML Text'
),
(
'docx'
,
'Microsoft Word 2007/2010 XML'
),
(
'html'
,
'HTML Document (Writer)'
),
(
'html'
,
'HTML Document (OpenOffice.org Writer)'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'html'
,
'XHTML'
),
(
'odt'
,
'ODF Text Document'
),
(
'odt'
,
'ODF Text Document'
),
(
'ott'
,
'ODF Text Document Template'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'rtf'
,
'Rich Text Format'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'sdw'
,
'StarWriter 3.0'
),
(
'rtf'
,
'Rich Text'
),
(
'sdw'
,
'StarWriter 4.0'
),
(
'sdw'
,
'StarWriter 5.0'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document'
),
(
'txt'
,
'Text Encoded'
),
(
'txt'
,
'Text Encoded'
),
(
'txt'
,
'Text'
),
(
'pdb'
,
'AportisDoc (Palm)'
),
(
'psw'
,
'Pocket Word'
),
)
)
global_expected_tuple
=
(
global_expected_tuple
=
(
...
@@ -61,12 +52,10 @@ drawing_expected_tuple = (
...
@@ -61,12 +52,10 @@ drawing_expected_tuple = (
(
'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'
),
(
'html'
,
'HTML Document (OpenOffice.org Draw)'
),
(
'html'
,
'HTML Document (Draw)'
),
(
'html'
,
'XHTML'
),
(
'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'
),
(
'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'
),
...
@@ -74,8 +63,6 @@ drawing_expected_tuple = (
...
@@ -74,8 +63,6 @@ drawing_expected_tuple = (
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'sda'
,
'StarDraw 5.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'
),
...
@@ -86,11 +73,11 @@ drawing_expected_tuple = (
...
@@ -86,11 +73,11 @@ drawing_expected_tuple = (
web_expected_tuple
=
(
web_expected_tuple
=
(
(
'html'
,
'HTML Document'
),
(
'html'
,
'HTML Document'
),
(
'odt'
,
'
OpenOffice.org Text (OpenOffice.org
Writer/Web)'
),
(
'odt'
,
'
Text (
Writer/Web)'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document (
OpenOffice.org
Writer/Web)'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document (Writer/Web)'
),
(
'txt'
,
'Text (
OpenOffice.org
Writer/Web)'
),
(
'txt'
,
'Text (Writer/Web)'
),
(
'txt'
,
'Text Encoded (
OpenOffice.org
Writer/Web)'
),
(
'txt'
,
'Text Encoded (Writer/Web)'
),
)
)
presentation_expected_tuple
=
(
presentation_expected_tuple
=
(
...
@@ -98,30 +85,27 @@ presentation_expected_tuple = (
...
@@ -98,30 +85,27 @@ presentation_expected_tuple = (
(
'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'
),
(
'html'
,
'HTML Document (OpenOffice.org Impress)'
),
(
'html'
,
'HTML Document (Impress)'
),
(
'html'
,
'XHTML'
),
(
'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 (Impress)'
),
(
'odg'
,
'ODF Drawing (Impress)'
),
(
'odp'
,
'ODF Presentation'
),
(
'odp'
,
'ODF Presentation'
),
(
'otp'
,
'ODF Presentation Template'
),
(
'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'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'pot'
,
'Microsoft PowerPoint 97/2000/XP/2003 Template'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'
),
(
'ppsx'
,
'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay'
),
(
'ppsx'
,
'Office Open XML Presentation AutoPlay'
),
(
'ppt'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'ppt'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'pptx'
,
'Microsoft PowerPoint 2007/2010/2013 XML'
),
(
'pptx'
,
'Office Open XML Presentation'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'sda'
,
'StarDraw 5.0 (OpenOffice.org Impress)'
),
(
'sdd'
,
'StarDraw 3.0 (OpenOffice.org Impress)'
),
(
'sdd'
,
'StarImpress 4.0'
),
(
'sdd'
,
'StarImpress 5.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 (
OpenOffice.org
Impress)'
),
(
'sxd'
,
'OpenOffice.org 1.0 Drawing (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'
),
(
'wmf'
,
'WMF - Windows Metafile'
),
(
'wmf'
,
'WMF - Windows Metafile'
),
...
@@ -130,23 +114,13 @@ presentation_expected_tuple = (
...
@@ -130,23 +114,13 @@ presentation_expected_tuple = (
spreadsheet_expected_list
=
(
spreadsheet_expected_list
=
(
(
'csv'
,
'Text CSV'
),
(
'csv'
,
'Text CSV'
),
(
'html'
,
'HTML Document (OpenOffice.org Calc)'
),
(
'html'
,
'HTML Document (Calc)'
),
(
'html'
,
'XHTML'
),
(
'ods'
,
'ODF Spreadsheet'
),
(
'ods'
,
'ODF Spreadsheet'
),
(
'ots'
,
'ODF Spreadsheet Template'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'sdc'
,
'StarCalc 3.0'
),
(
'sdc'
,
'StarCalc 4.0'
),
(
'sdc'
,
'StarCalc 5.0'
),
(
'slk'
,
'SYLK'
),
(
'slk'
,
'SYLK'
),
(
'sxc'
,
'OpenOffice.org 1.0 Spreadsheet'
),
(
'sxc'
,
'OpenOffice.org 1.0 Spreadsheet'
),
(
'xls'
,
'Microsoft Excel 5.0'
),
(
'xls'
,
'Microsoft Excel 95'
),
(
'xls'
,
'Microsoft Excel 97/2000/XP/2003'
),
(
'xls'
,
'Microsoft Excel 97/2000/XP/2003'
),
(
'xlt'
,
'Microsoft Excel 5.0 Template'
),
(
'xlsx'
,
'Microsoft Excel 2007/2010/2013 XML'
),
(
'xlt'
,
'Microsoft Excel 95 Template'
),
(
'xlt'
,
'Microsoft Excel 97/2000/XP/2003 Template'
),
(
'xlsx'
,
'Microsoft Excel 2007/2010 XML'
),
(
'xlsx'
,
'Office Open XML Spreadsheet'
),
(
'xlsx'
,
'Office Open XML Spreadsheet'
),
)
)
...
@@ -161,6 +135,7 @@ math_expected_tuple = (
...
@@ -161,6 +135,7 @@ math_expected_tuple = (
)
)
chart_expected_tuple
=
(
chart_expected_tuple
=
(
(
'odc'
,
'ODF Chart'
),
)
)
OPENOFFICE
=
True
OPENOFFICE
=
True
...
@@ -207,9 +182,9 @@ class TestMimeMapper(HandlerTestCase):
...
@@ -207,9 +182,9 @@ class TestMimeMapper(HandlerTestCase):
pdf_filter_list
=
self
.
mimemapper
.
getFilterList
(
'pdf'
)
pdf_filter_list
=
self
.
mimemapper
.
getFilterList
(
'pdf'
)
self
.
assertEquals
(
len
(
pdf_filter_list
),
5
)
self
.
assertEquals
(
len
(
pdf_filter_list
),
5
)
xls_filter_list
=
self
.
mimemapper
.
getFilterList
(
'xls'
)
xls_filter_list
=
self
.
mimemapper
.
getFilterList
(
'xls'
)
self
.
assertEquals
(
len
(
xls_filter_list
),
3
)
self
.
assertEquals
(
len
(
xls_filter_list
),
1
)
doc_filter_list
=
self
.
mimemapper
.
getFilterList
(
'doc'
)
doc_filter_list
=
self
.
mimemapper
.
getFilterList
(
'doc'
)
self
.
assertEquals
(
len
(
doc_filter_list
),
3
)
self
.
assertEquals
(
len
(
doc_filter_list
),
1
)
def
testGetDocumentTypeDict
(
self
):
def
testGetDocumentTypeDict
(
self
):
"""Test if dictonary document type returns type correctly."""
"""Test if dictonary document type returns type correctly."""
...
@@ -217,10 +192,7 @@ class TestMimeMapper(HandlerTestCase):
...
@@ -217,10 +192,7 @@ class TestMimeMapper(HandlerTestCase):
type
=
document_type_dict
.
get
(
"text"
)
type
=
document_type_dict
.
get
(
"text"
)
self
.
assertEquals
(
type
,
'com.sun.star.text.TextDocument'
)
self
.
assertEquals
(
type
,
'com.sun.star.text.TextDocument'
)
type
=
document_type_dict
.
get
(
"chart"
)
type
=
document_type_dict
.
get
(
"chart"
)
# For now, chart document filters are maked as NotInFileDialog and
self
.
assertEquals
(
type
,
'com.sun.star.chart2.ChartDocument'
)
# NotInChooser.
# self.assertEquals(type, 'com.sun.star.chart2.ChartDocument')
self
.
assertEquals
(
type
,
None
)
type
=
document_type_dict
.
get
(
"drawing"
)
type
=
document_type_dict
.
get
(
"drawing"
)
self
.
assertEquals
(
type
,
'com.sun.star.drawing.DrawingDocument'
)
self
.
assertEquals
(
type
,
'com.sun.star.drawing.DrawingDocument'
)
type
=
document_type_dict
.
get
(
"presentation"
)
type
=
document_type_dict
.
get
(
"presentation"
)
...
...
cloudooo/handler/ooo/tests/testOooServer.py
View file @
fc7346d0
...
@@ -36,68 +36,12 @@ from zipfile import ZipFile, is_zipfile
...
@@ -36,68 +36,12 @@ from zipfile import ZipFile, is_zipfile
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
from
cloudooo.tests.backportUnittest
import
expectedFailure
from
cloudooo.tests.backportUnittest
import
expectedFailure
import
magic
import
magic
from
cloudooo.handler.ooo.tests.testOooMimemapper
import
text_expected_tuple
,
presentation_expected_tuple
class
TestServer
(
TestCase
):
class
TestServer
(
TestCase
):
"""Test XmlRpc Server. Needs cloudooo server started"""
"""Test XmlRpc Server. Needs cloudooo server started"""
def
afterSetUp
(
self
):
"""Set up expected lists for each type """
# XXX Duplicated list of filters
self
.
text_expected_list
=
[[
'doc'
,
'Microsoft Word 6.0'
],
[
'doc'
,
'Microsoft Word 95'
],
[
'doc'
,
'Microsoft Word 97/2000/XP/2003'
],
[
'docx'
,
'Microsoft Word 2007/2010 XML'
],
[
'docx'
,
'Office Open XML Text'
],
[
'htm'
,
'HTML Document (OpenOffice.org Writer)'
],
[
'html'
,
'HTML Document (OpenOffice.org Writer)'
],
[
'html'
,
'XHTML'
],
[
'odt'
,
'ODF Text Document'
],
[
'ott'
,
'ODF Text Document Template'
],
[
'pdf'
,
'PDF - Portable Document Format'
],
[
'rtf'
,
'Rich Text Format'
],
[
'sdw'
,
'StarWriter 3.0'
],
[
'sdw'
,
'StarWriter 4.0'
],
[
'sdw'
,
'StarWriter 5.0'
],
[
'sxw'
,
'OpenOffice.org 1.0 Text Document'
],
[
'txt'
,
'Text'
],
[
'txt'
,
'Text Encoded'
],
[
'xhtml'
,
'XHTML'
],
[
'pdb'
,
'AportisDoc (Palm)'
],
[
'psw'
,
'Pocket Word'
]]
self
.
presentation_expected_list
=
[[
'bmp'
,
'BMP - Windows Bitmap'
],
[
'emf'
,
'EMF - Enhanced Metafile'
],
[
'eps'
,
'EPS - Encapsulated PostScript'
],
[
'gif'
,
'GIF - Graphics Interchange Format'
],
[
'htm'
,
'HTML Document (OpenOffice.org Impress)'
],
[
'html'
,
'HTML Document (OpenOffice.org Impress)'
],
[
'html'
,
'XHTML'
],
[
'jfif'
,
'JPEG - Joint Photographic Experts Group'
],
[
'jif'
,
'JPEG - Joint Photographic Experts Group'
],
[
'jpe'
,
'JPEG - Joint Photographic Experts Group'
],
[
'jpeg'
,
'JPEG - Joint Photographic Experts Group'
],
[
'jpg'
,
'JPEG - Joint Photographic Experts Group'
],
[
'met'
,
'MET - OS/2 Metafile'
],
[
'odg'
,
'ODF Drawing (Impress)'
],
[
'odp'
,
'ODF Presentation'
],
[
'otp'
,
'ODF Presentation Template'
],
[
'pbm'
,
'PBM - Portable Bitmap'
],
[
'pct'
,
'PCT - Mac Pict'
],
[
'pdf'
,
'PDF - Portable Document Format'
],
[
'pgm'
,
'PGM - Portable Graymap'
],
[
'pict'
,
'PCT - Mac Pict'
],
[
'png'
,
'PNG - Portable Network Graphic'
],
[
'pot'
,
'Microsoft PowerPoint 97/2000/XP/2003 Template'
],
[
'ppm'
,
'PPM - Portable Pixelmap'
],
[
'pps'
,
'Microsoft PowerPoint 97/2000/XP'
],
[
'ppt'
,
'Microsoft PowerPoint 97/2000/XP/2003'
],
[
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'
],
[
'ras'
,
'RAS - Sun Raster Image'
],
[
'sda'
,
'StarDraw 5.0 (OpenOffice.org Impress)'
],
[
'sdd'
,
'StarDraw 3.0 (OpenOffice.org Impress)'
],
[
'sdd'
,
'StarImpress 4.0'
],
[
'sdd'
,
'StarImpress 5.0'
],
[
'svg'
,
'SVG - Scalable Vector Graphics'
],
[
'svm'
,
'SVM - StarView Metafile'
],
[
'sxd'
,
'OpenOffice.org 1.0 Drawing (OpenOffice.org Impress)'
],
[
'sxi'
,
'OpenOffice.org 1.0 Presentation'
],
[
'tif'
,
'TIFF - Tagged Image File Format'
],
[
'tiff'
,
'TIFF - Tagged Image File Format'
],
[
'wmf'
,
'WMF - Windows Metafile'
],
[
'xhtml'
,
'XHTML'
],
[
'xpm'
,
'XPM - X PixMap'
]]
self
.
text_expected_list
.
sort
()
self
.
presentation_expected_list
.
sort
()
def
testGetAllowedTextExtensionListByType
(
self
):
def
testGetAllowedTextExtensionListByType
(
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 document type as text"""
ui_name. The request is by document type as text"""
...
@@ -105,8 +49,8 @@ class TestServer(TestCase):
...
@@ -105,8 +49,8 @@ class TestServer(TestCase):
text_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
text_request
)
text_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
text_request
)
text_allowed_list
.
sort
()
text_allowed_list
.
sort
()
for
arg
in
text_allowed_list
:
for
arg
in
text_allowed_list
:
self
.
assertTrue
(
arg
in
self
.
text_expected_list
,
self
.
assertTrue
(
tuple
(
arg
)
in
text_expected_tuple
,
"%s not in %s"
%
(
arg
,
self
.
text_expected_list
))
"%s not in %s"
%
(
arg
,
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
...
@@ -115,8 +59,8 @@ class TestServer(TestCase):
...
@@ -115,8 +59,8 @@ class TestServer(TestCase):
presentation_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
request_dict
)
presentation_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
request_dict
)
presentation_allowed_list
.
sort
()
presentation_allowed_list
.
sort
()
for
arg
in
presentation_allowed_list
:
for
arg
in
presentation_allowed_list
:
self
.
assertTrue
(
arg
in
self
.
presentation_expected_list
,
self
.
assertTrue
(
tuple
(
arg
)
in
presentation_expected_tuple
,
"%s not in %s"
%
(
arg
,
self
.
presentation_expected_list
))
"%s not in %s"
%
(
arg
,
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
...
@@ -124,8 +68,8 @@ class TestServer(TestCase):
...
@@ -124,8 +68,8 @@ class TestServer(TestCase):
doc_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
({
'extension'
:
"doc"
})
doc_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
({
'extension'
:
"doc"
})
doc_allowed_list
.
sort
()
doc_allowed_list
.
sort
()
for
arg
in
doc_allowed_list
:
for
arg
in
doc_allowed_list
:
self
.
assertTrue
(
arg
in
self
.
text_expected_list
,
self
.
assertTrue
(
tuple
(
arg
)
in
text_expected_tuple
,
"%s not in %s"
%
(
arg
,
self
.
text_expected_list
))
"%s not in %s"
%
(
arg
,
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
...
@@ -134,8 +78,8 @@ class TestServer(TestCase):
...
@@ -134,8 +78,8 @@ class TestServer(TestCase):
msword_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
request_dict
)
msword_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
request_dict
)
msword_allowed_list
.
sort
()
msword_allowed_list
.
sort
()
for
arg
in
msword_allowed_list
:
for
arg
in
msword_allowed_list
:
self
.
assertTrue
(
arg
in
self
.
text_expected_list
,
self
.
assertTrue
(
tuple
(
arg
)
in
text_expected_tuple
,
"%s not in %s"
%
(
arg
,
self
.
text_expected_list
))
"%s not in %s"
%
(
arg
,
text_expected_tuple
))
def
ConversionScenarioList
(
self
):
def
ConversionScenarioList
(
self
):
return
[
return
[
...
@@ -148,7 +92,7 @@ class TestServer(TestCase):
...
@@ -148,7 +92,7 @@ class TestServer(TestCase):
(
join
(
'data'
,
'test.docx'
),
"docx"
,
"odt"
,
"application/vnd.oasis."
+
(
join
(
'data'
,
'test.docx'
),
"docx"
,
"odt"
,
"application/vnd.oasis."
+
"opendocument.text"
),
"opendocument.text"
),
# Test export python to pdf
# Test export python to pdf
(
__file__
,
"
py
"
,
"pdf"
,
"application/pdf"
),
(
__file__
,
"
txt
"
,
"pdf"
,
"application/pdf"
),
]
]
def
testConvert
(
self
):
def
testConvert
(
self
):
...
@@ -190,12 +134,12 @@ class TestServer(TestCase):
...
@@ -190,12 +134,12 @@ class TestServer(TestCase):
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Data
=
''
,
Title
=
'clo'
+
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Data
=
''
,
Title
=
'clo'
+
'udooo Test'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
'udooo Test'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
Keywords
=
'Keywords Test'
)),
Keywords
=
[
'Keywords Test'
]
)),
# Test method getFileMetadataItemList. With data converted
# Test method getFileMetadataItemList. With data converted
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Test'
,
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Test'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
Keywords
=
'Keywords Test'
),
Keywords
=
[
'Keywords Test'
]),
True
),
True
),
]
]
...
@@ -217,9 +161,10 @@ class TestServer(TestCase):
...
@@ -217,9 +161,10 @@ class TestServer(TestCase):
return
[
return
[
# Test server using method updateFileMetadata
# Test server using method updateFileMetadata
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'testSetMetadata'
)),
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'testSetMetadata'
)),
# Test server using method updateFileMetadata with unsual metadata
# XXX adding a custom metadata is not yet supported
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Reference
=
'testSet'
+
# # Test server using method updateFileMetadata with unsual metadata
'Metadata'
)),
# (join('data', 'testMetadata.odt'), "odt", dict(Reference='testSet'+
# 'Metadata')),
# Test document that already has metadata. Check if the metadata is
# Test document that already has metadata. Check if the metadata is
# not deleted, but updated
# not deleted, but updated
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Title'
)),
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Title'
)),
...
@@ -242,8 +187,9 @@ class TestServer(TestCase):
...
@@ -242,8 +187,9 @@ class TestServer(TestCase):
self
.
assertEquals
(
self
.
_getFileType
(
new_odf_data
),
self
.
assertEquals
(
self
.
_getFileType
(
new_odf_data
),
'application/vnd.oasis.opendocument.text'
)
'application/vnd.oasis.opendocument.text'
)
metadata_dict
=
self
.
proxy
.
getFileMetadataItemList
(
new_odf_data
,
'odt'
)
metadata_dict
=
self
.
proxy
.
getFileMetadataItemList
(
new_odf_data
,
'odt'
)
self
.
assertEquals
(
metadata_dict
.
get
(
"Reference"
),
"new value"
)
# XXX adding a custom metadata is not yet supported
self
.
assertEquals
(
metadata_dict
.
get
(
"Something"
),
"ABC"
)
# self.assertEquals(metadata_dict.get("Reference"), "new value")
# self.assertEquals(metadata_dict.get("Something"), "ABC")
def
ConvertScenarioList
(
self
):
def
ConvertScenarioList
(
self
):
return
[
return
[
...
@@ -437,28 +383,14 @@ class TestServer(TestCase):
...
@@ -437,28 +383,14 @@ class TestServer(TestCase):
response_code
,
response_dict
,
response_message
=
\
response_code
,
response_dict
,
response_message
=
\
self
.
proxy
.
getAllowedTargetItemList
(
mimetype
)
self
.
proxy
.
getAllowedTargetItemList
(
mimetype
)
self
.
assertEquals
(
response_code
,
200
)
self
.
assertEquals
(
response_code
,
200
)
list_for_mimetype
=
[[
'html'
,
'HTML Document (OpenOffice.org Writer)'
],
[
'txt'
,
'Text Encoded'
],
[
'doc'
,
'Microsoft Word 6.0'
],
[
'doc'
,
'Microsoft Word 95'
],
[
'doc'
,
'Microsoft Word 97/2000/XP/2003'
],
[
'ott'
,
'ODF Text Document Template'
],
[
'rtf'
,
'Rich Text Format'
],
[
'docx'
,
'Microsoft Word 2007/2010 XML'
],
[
'sxw'
,
'OpenOffice.org 1.0 Text Document'
],
[
'txt'
,
'Text Encoded'
],
[
'docx'
,
'Office Open XML Text'
],
[
'odt'
,
'ODF Text Document'
],
[
'pdf'
,
'PDF - Portable Document Format'
]
]
# Verify if all expected types are in response list
# Verify if all expected types are in response list
for
arg
in
list_for_mimetyp
e
:
for
arg
in
text_expected_tupl
e
:
self
.
assertTrue
(
arg
in
response_dict
[
'response_data'
],
self
.
assertTrue
(
list
(
arg
)
in
response_dict
[
'response_data'
],
"%s not in %s"
%
(
arg
,
response_dict
[
'response_data'
]))
"%s not in %s"
%
(
arg
,
response_dict
[
'response_data'
]))
# Verify if all types in response list are expected
# Verify if all types in response list are expected
for
arg
in
response_dict
[
'response_data'
]:
for
arg
in
response_dict
[
'response_data'
]:
self
.
assertTrue
(
arg
in
list_for_mimetyp
e
,
self
.
assertTrue
(
tuple
(
arg
)
in
text_expected_tupl
e
,
"%s not in %s"
%
(
arg
,
list_for_mimetyp
e
))
"%s not in %s"
%
(
arg
,
text_expected_tupl
e
))
def
testGetTableItemListFromOdt
(
self
):
def
testGetTableItemListFromOdt
(
self
):
"""Test if getTableItemList can get the table item list from odt file"""
"""Test if getTableItemList can get the table item list from odt file"""
...
@@ -553,7 +485,7 @@ class TestServer(TestCase):
...
@@ -553,7 +485,7 @@ class TestServer(TestCase):
self
.
assertEquals
([[
'10000000000000C80000009CA3D5C3B7.jpg'
,
''
],
self
.
assertEquals
([[
'10000000000000C80000009CA3D5C3B7.jpg'
,
''
],
[
'10000201000000C80000004E7B947D46.png'
,
'TioLive Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
'TioLive Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
''
],
[
'10000201000000C80000004E7B947D46.png'
,
''
],
[
'2000004F0000423300001370
A30E6D5
A.svm'
,
'Python Logo'
],
[
'2000004F0000423300001370
7E7DE37
A.svm'
,
'Python Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
[
'10000201000000C80000004E7B947D46.png'
,
'Again TioLive Logo'
]],
'Again TioLive Logo'
]],
image_list
)
image_list
)
...
@@ -565,7 +497,7 @@ class TestServer(TestCase):
...
@@ -565,7 +497,7 @@ class TestServer(TestCase):
self
.
assertEquals
([[
'10000000000000C80000009CA3D5C3B7.jpg'
,
''
],
self
.
assertEquals
([[
'10000000000000C80000009CA3D5C3B7.jpg'
,
''
],
[
'10000201000000C80000004E7B947D46.png'
,
'TioLive Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
'TioLive Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
''
],
[
'10000201000000C80000004E7B947D46.png'
,
''
],
[
'200003160000423300001370
F468B63D
.wmf'
,
'Python Logo'
],
[
'200003160000423300001370
6A5EA1C8
.wmf'
,
'Python Logo'
],
[
'10000201000000C80000004E7B947D46.png'
,
[
'10000201000000C80000004E7B947D46.png'
,
'Again TioLive Logo'
]],
'Again TioLive Logo'
]],
image_list
)
image_list
)
...
...
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