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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
cloudooo
Commits
60dda98b
Commit
60dda98b
authored
Jun 07, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to cloudoootestcase
parent
f013ec03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
28 deletions
+16
-28
cloudooo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
...oo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
+16
-28
No files found.
cloudooo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
View file @
60dda98b
...
@@ -26,59 +26,47 @@
...
@@ -26,59 +26,47 @@
#
#
##############################################################################
##############################################################################
from
xmlrpclib
import
ServerProxy
,
Fault
from
xmlrpclib
import
Fault
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
from
base64
import
encodestring
import
magic
file_detector
=
magic
.
Magic
()
class
TestAllFormatsERP5Compatibility
(
TestCase
):
DAEMON
=
True
class
TestAllFormatsERP5Compatibility
(
HandlerTestCase
):
"""
"""
Test XmlRpc Server using ERP5 compatibility API.
Test XmlRpc Server using ERP5 compatibility API.
Needs cloudooo server started
Needs cloudooo server started
"""
"""
def
afterSetUp
(
self
):
"""Create connection with cloudooo server"""
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
def
testTextFormats
(
self
):
def
testTextFormats
(
self
):
"""Test all text formats"""
"""Test all text formats"""
self
.
runTestForType
(
'
odt'
,
'application/vnd.oasis.opendocument.text'
,
'data/test.od
t'
)
self
.
runTestForType
(
'
data/test.odt'
,
'odt'
,
'application/vnd.oasis.opendocument.tex
t'
)
def
testPresentationFormats
(
self
):
def
testPresentationFormats
(
self
):
"""Test all presentation formats"""
"""Test all presentation formats"""
self
.
runTestForType
(
'
odp'
,
'application/vnd.oasis.opendocument.presentation'
,
'data/test.odp
'
)
self
.
runTestForType
(
'
data/test.odp'
,
'odp'
,
'application/vnd.oasis.opendocument.presentation
'
)
def
testDrawingFormats
(
self
):
def
testDrawingFormats
(
self
):
"""Test all drawing formats"""
"""Test all drawing formats"""
self
.
runTestForType
(
'
odg'
,
'application/vnd.oasis.opendocument.graphics'
,
'data/test.odg
'
)
self
.
runTestForType
(
'
data/test.odg'
,
'odg'
,
'application/vnd.oasis.opendocument.graphics
'
)
def
testSpreadSheetFormats
(
self
):
def
testSpreadSheetFormats
(
self
):
"""Test all spreadsheet formats"""
"""Test all spreadsheet formats"""
self
.
runTestForType
(
'
ods'
,
'application/vnd.oasis.opendocument.spreadsheet'
,
'data/test.ods
'
)
self
.
runTestForType
(
'
data/test.ods'
,
'ods'
,
'application/vnd.oasis.opendocument.spreadsheet
'
)
def
runTestForType
(
self
,
source_format
,
mime_type
,
filenam
e
):
def
runTestForType
(
self
,
filename
,
source_format
,
source_mimetyp
e
):
"""Generic test"""
"""Generic test"""
data
=
open
(
filename
,
'r'
).
read
()
extension_list
=
self
.
proxy
.
getAllowedTargetItemList
(
source_mimetype
)[
1
][
'response_data'
]
extension_list
=
self
.
proxy
.
getAllowedTargetItemList
(
mime_type
)[
1
][
'response_data'
]
fault_list
=
[]
fault_list
=
[]
for
extension
,
format
in
extension_list
:
for
extension
,
format
in
extension_list
:
try
:
try
:
data_output
=
self
.
proxy
.
run_generate
(
filename
,
data_output
=
self
.
proxy
.
run_generate
(
filename
,
encodestring
(
data
),
encodestring
(
open
(
filename
).
read
()),
None
,
None
,
extension
,
extension
,
mime_type
)[
1
][
'data'
]
source_mimetype
)[
1
][
'data'
]
magic_result
=
file_detector
.
from_buffer
(
decodestring
(
data_output
))
file_type
=
self
.
_getFileType
(
data_output
)
file_is_empty
=
magic_result
.
endswith
(
": empty"
)
if
file_type
.
endswith
(
": empty"
):
if
file_is_empty
:
fault_list
.
append
((
source_format
,
extension
,
file_type
))
fault_list
.
append
((
source_format
,
extension
,
magic_result
))
except
Fault
,
err
:
except
Fault
,
err
:
fault_list
.
append
((
source_format
,
extension
,
err
.
faultString
))
fault_list
.
append
((
source_format
,
extension
,
err
.
faultString
))
if
fault_list
:
if
fault_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