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 @@
...
@@ -26,61 +26,41 @@
#
#
##############################################################################
##############################################################################
from
xmlrpclib
import
ServerProxy
from
base64
import
encodestring
,
decodestring
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
import
magic
from
pkg_resources
import
resource_filename
from
pkg_resources
import
resource_filename
file_detector
=
magic
.
Magic
(
mime
=
True
)
DAEMON
=
True
class
TestLegacyInterface
(
HandlerTestCase
):
class
TestLegacyInterface
(
TestCase
):
def
afterSetUp
(
self
):
"""Create connection with cloudooo server"""
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
def
testHtmlToBaseFormatConversion
(
self
):
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'
,
filename
=
resource_filename
(
'cloudooo.handler.ooo.tests.data'
,
'test_failure_conversion.html'
)
'test_failure_conversion.html'
)
file_object
=
open
(
filename
,
'r'
)
data
=
open
(
filename
,
'r'
).
read
()
original_data
=
file_object
.
read
()
file_object
.
close
()
status
,
response_dict
,
message
=
self
.
proxy
.
run_convert
(
status
,
response_dict
,
message
=
self
.
proxy
.
run_convert
(
filename
,
filename
,
encodestring
(
original_
data
),
encodestring
(
data
),
None
,
None
,
None
,
None
,
'text/html'
)
'text/html'
)
converted_data
=
response_dict
[
'data'
]
self
.
assertEquals
(
self
.
_getFileType
(
decodestring
(
response_dict
[
'data'
])),
mimetype
=
response_dict
[
'mime'
]
self
.
assertEquals
(
file_detector
.
from_buffer
(
decodestring
(
converted_data
)),
'text/html'
)
'text/html'
)
self
.
assertEquals
(
mimetype
,
'text/html'
)
self
.
assertEquals
(
response_dict
[
'mime'
]
,
'text/html'
)
def
testHtmlToOdt
(
self
):
def
testHtmlToOdt
(
self
):
"""Check conversion of HTML to odt
"""Check conversion of HTML to odt"""
"""
filename
=
resource_filename
(
'cloudooo.handler.ooo.tests.data'
,
filename
=
resource_filename
(
'cloudooo.handler.ooo.tests.data'
,
'test_failure_conversion.html'
)
'test_failure_conversion.html'
)
file_object
=
open
(
filename
,
'r'
)
data
=
open
(
filename
,
'r'
).
read
()
data
=
file_object
.
read
()
file_object
.
close
()
status
,
response_dict
,
message
=
self
.
proxy
.
run_generate
(
filename
,
status
,
response_dict
,
message
=
self
.
proxy
.
run_generate
(
filename
,
encodestring
(
data
),
encodestring
(
data
),
None
,
None
,
'odt'
,
'odt'
,
'text/html'
)
'text/html'
)
data
=
response_dict
[
'data'
]
self
.
assertEquals
(
self
.
_getFileType
(
decodestring
(
response_dict
[
'data'
])),
mimetype
=
response_dict
[
'mime'
]
self
.
assertEquals
(
file_detector
.
from_buffer
(
decodestring
(
data
)),
'application/vnd.oasis.opendocument.text'
)
'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
():
def
test_suite
():
return
make_suite
(
TestLegacyInterface
)
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