Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
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
Kirill Smelkov
cloudooo
Commits
f530b4ce
Commit
f530b4ce
authored
Jun 07, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to cloudoootestcase
parent
60dda98b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
31 deletions
+11
-31
cloudooo/handler/ooo/tests/testOooLegacyInterface.py
cloudooo/handler/ooo/tests/testOooLegacyInterface.py
+11
-31
No files found.
cloudooo/handler/ooo/tests/testOooLegacyInterface.py
View file @
f530b4ce
...
...
@@ -26,61 +26,41 @@
#
##############################################################################
from
xmlrpclib
import
ServerProxy
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
import
magic
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
from
pkg_resources
import
resource_filename
file_detector
=
magic
.
Magic
(
mime
=
True
)
DAEMON
=
True
class
TestLegacyInterface
(
HandlerTestCase
):
def
afterSetUp
(
self
):
"""Create connection with cloudooo server"""
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
class
TestLegacyInterface
(
TestCase
):
def
testHtmlToBaseFormatConversion
(
self
):
"""Check implicit base conversion of HTML documents.
"""
"""Check implicit base conversion of HTML documents."""
filename
=
resource_filename
(
'cloudooo.handler.ooo.tests.data'
,
'test_failure_conversion.html'
)
file_object
=
open
(
filename
,
'r'
)
original_data
=
file_object
.
read
()
file_object
.
close
()
data
=
open
(
filename
,
'r'
).
read
()
status
,
response_dict
,
message
=
self
.
proxy
.
run_convert
(
filename
,
encodestring
(
original_
data
),
encodestring
(
data
),
None
,
None
,
'text/html'
)
converted_data
=
response_dict
[
'data'
]
mimetype
=
response_dict
[
'mime'
]
self
.
assertEquals
(
file_detector
.
from_buffer
(
decodestring
(
converted_data
)),
self
.
assertEquals
(
self
.
_getFileType
(
decodestring
(
response_dict
[
'data'
])),
'text/html'
)
self
.
assertEquals
(
mimetype
,
'text/html'
)
self
.
assertEquals
(
response_dict
[
'mime'
]
,
'text/html'
)
def
testHtmlToOdt
(
self
):
"""Check conversion of HTML to odt
"""
"""Check conversion of HTML to odt"""
filename
=
resource_filename
(
'cloudooo.handler.ooo.tests.data'
,
'test_failure_conversion.html'
)
file_object
=
open
(
filename
,
'r'
)
data
=
file_object
.
read
()
file_object
.
close
()
data
=
open
(
filename
,
'r'
).
read
()
status
,
response_dict
,
message
=
self
.
proxy
.
run_generate
(
filename
,
encodestring
(
data
),
None
,
'odt'
,
'text/html'
)
data
=
response_dict
[
'data'
]
mimetype
=
response_dict
[
'mime'
]
self
.
assertEquals
(
file_detector
.
from_buffer
(
decodestring
(
data
)),
self
.
assertEquals
(
self
.
_getFileType
(
decodestring
(
response_dict
[
'data'
])),
'application/vnd.oasis.opendocument.text'
)
self
.
assertEquals
(
mimetype
,
'application/vnd.oasis.opendocument.text'
)
self
.
assertEquals
(
response_dict
[
'mime'
]
,
'application/vnd.oasis.opendocument.text'
)
def
test_suite
():
return
make_suite
(
TestLegacyInterface
)
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