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
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
Roque
cloudooo
Commits
af933eee
Commit
af933eee
authored
Jun 01, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TYPO
parent
30c8240a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
49 deletions
+49
-49
cloudooo/handler/ooo/tests/testServer.py
cloudooo/handler/ooo/tests/testServer.py
+49
-49
No files found.
cloudooo/handler/ooo/tests/testServer.py
View file @
af933eee
...
...
@@ -34,44 +34,44 @@ from cloudooo.tests.cloudoooTestCase import TestCase, make_suite
class
TestServer
(
TestCase
):
"""Test XmlRpc Server. Needs cloudooo server started"""
#
def ConversionScenarioList(self):
#
return [
#
# Test Convert Doc -> Odt
#
(join('data', 'test.doc'), "doc", "odt", "application/vnd.oasis."+
#
"opendocument.text"),
#
# Test export png to svg
#
(join('data', 'test.png'), "png", "svg", "image/svg+xml"),
#
# Test export docx to odt
#
(join('data', 'test.docx'), "docx", "odt", "application/vnd.oasis."+
#
"opendocument.text"),
#
# Test export python to pdf
#
(__file__, "py", "pdf", "application/pdf"),
#
# Test if send a zipfile returns a document correctly
#
(join('data', 'test.zip'), "zip", "txt", "application/zip", True),
#
# Convert compressed html to txt
#
(join('data', 'test.zip'), "zip", "txt", "text/plain"),
#
# Test export pptx to odp
#
(join('data', 'test.pptx'), "pptx", "odp", "application/vnd.oasis."+
#
"opendocument.presentation"),
#
]
#
def testConvert(self):
#
"""Convert OOofiles"""
#
self.runConversionList(self.ConversionScenarioList())
#
def FaultConversionScenarioList(self):
#
return [
#
# Test to verify if server fail when a empty string is sent
#
('', '', ''),
#
# Try convert one document for a invalid format
#
(open(join('data', 'test.doc')).read(), 'doc', 'xyz'),
#
# Try convert one document to format not possible
#
(open(join('data', 'test.odp')).read(), 'odp', 'doc'),
#
]
#
def testFaultConversion(self):
#
"""Convert Invalid OOofiles"""
#
self.runFaultConversionList(self.FaultConversionScenarioList())
def
ConversionScenarioList
(
self
):
return
[
# Test Convert Doc -> Odt
(
join
(
'data'
,
'test.doc'
),
"doc"
,
"odt"
,
"application/vnd.oasis."
+
"opendocument.text"
),
# Test export png to svg
(
join
(
'data'
,
'test.png'
),
"png"
,
"svg"
,
"image/svg+xml"
),
# Test export docx to odt
(
join
(
'data'
,
'test.docx'
),
"docx"
,
"odt"
,
"application/vnd.oasis."
+
"opendocument.text"
),
# Test export python to pdf
(
__file__
,
"py"
,
"pdf"
,
"application/pdf"
),
# Test if send a zipfile returns a document correctly
(
join
(
'data'
,
'test.zip'
),
"zip"
,
"txt"
,
"application/zip"
,
True
),
# Convert compressed html to txt
(
join
(
'data'
,
'test.zip'
),
"zip"
,
"txt"
,
"text/plain"
),
# Test export pptx to odp
(
join
(
'data'
,
'test.pptx'
),
"pptx"
,
"odp"
,
"application/vnd.oasis."
+
"opendocument.presentation"
),
]
def
testConvert
(
self
):
"""Convert OOofiles"""
self
.
runConversionList
(
self
.
ConversionScenarioList
())
def
FaultConversionScenarioList
(
self
):
return
[
# Test to verify if server fail when a empty string is sent
(
''
,
''
,
''
),
# Try convert one document for a invalid format
(
open
(
join
(
'data'
,
'test.doc'
)).
read
(),
'doc'
,
'xyz'
),
# Try convert one document to format not possible
(
open
(
join
(
'data'
,
'test.odp'
)).
read
(),
'odp'
,
'doc'
),
]
def
testFaultConversion
(
self
):
"""Convert Invalid OOofiles"""
self
.
runFaultConversionList
(
self
.
FaultConversionScenarioList
())
def
GetMetadataScenarioList
(
self
):
return
[
...
...
@@ -80,12 +80,12 @@ class TestServer(TestCase):
'udooo Test'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
ModifyDate
=
'2/8/2010 9:57:3'
,
Keywords
=
'Keywords Test'
)),
#
# Test method getFileMetadataItemList. With data converted
#
(join('data', 'testMetadata.odt'), "odt", dict(Title='cloudooo Test',
#
Subject='Subject Test', Description='cloudooo Comments',
#
Type='Text', MIMEType='application/vnd.oasis.opendocument.text',
#
ModifyDate='2/8/2010 9:57:3', Keywords='Keywords Test'),
#
True),
# Test method getFileMetadataItemList. With data converted
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Test'
,
Subject
=
'Subject Test'
,
Description
=
'cloudooo Comments'
,
Type
=
'Text'
,
MIMEType
=
'application/vnd.oasis.opendocument.text'
,
ModifyDate
=
'2/8/2010 9:57:3'
,
Keywords
=
'Keywords Test'
),
True
),
]
def
testGetMetadata
(
self
):
...
...
@@ -97,11 +97,11 @@ class TestServer(TestCase):
# Test server using method updateFileMetadata
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'testSetMetadata'
)),
# Test server using method updateFileMetadata with unsual metadata
#
(join('data', 'testMetadata.odt'), "odt", dict(Reference='testSet'+
#
'Metadata')),
#
# Test document that already has metadata. Check if the metadata is
#
# not deleted, but updated
#
(join('data', 'testMetadata.odt'), "odt", dict(Title='cloudooo Title')),
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Reference
=
'testSet'
+
'Metadata'
)),
# Test document that already has metadata. Check if the metadata is
# not deleted, but updated
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Title'
)),
]
def
testUpdateMetadata
(
self
):
...
...
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