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
caf1f2ea
Commit
caf1f2ea
authored
Jun 03, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented new method to test run_convert
parent
67d9ee33
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
210 additions
and
185 deletions
+210
-185
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+177
-185
cloudooo/tests/cloudoooTestCase.py
cloudooo/tests/cloudoooTestCase.py
+33
-0
No files found.
cloudooo/handler/ooo/tests/testOooServer.py
View file @
caf1f2ea
This diff is collapsed.
Click to expand it.
cloudooo/tests/cloudoooTestCase.py
View file @
caf1f2ea
...
...
@@ -4,6 +4,7 @@ from os import environ
from
ConfigParser
import
ConfigParser
from
xmlrpclib
import
ServerProxy
,
Fault
from
magic
import
Magic
from
types
import
DictType
from
base64
import
encodestring
,
decodestring
config
=
ConfigParser
()
...
...
@@ -26,6 +27,10 @@ class TestCase(unittest.TestCase):
self
.
env_path
=
config
.
get
(
"app:main"
,
"env-path"
)
self
.
proxy
=
ServerProxy
((
"http://%s:%s/RPC2"
%
(
self
.
hostname
,
self
.
port
)),
\
allow_none
=
True
)
self
.
afterSetUp
()
def
afterSetUp
(
self
):
"""Must be overwrite into subclass in case of need """
def
_getFileType
(
self
,
output_data
):
mime
=
Magic
(
mime
=
True
)
...
...
@@ -74,6 +79,24 @@ class TestCase(unittest.TestCase):
for
key
,
value
in
metadata_dict
.
iteritems
():
self
.
assertEquals
(
new_metadata_dict
[
key
],
value
)
def
_testRunConvert
(
self
,
filename
,
data
,
expected_response_code
,
response_dict_data
,
response_dict_keys
,
expected_response_message
,
response_dict_meta
=
None
):
"""Generic test for run_convert"""
response_code
,
response_dict
,
response_message
=
\
self
.
proxy
.
run_convert
(
filename
,
encodestring
(
data
))
self
.
assertEquals
(
response_code
,
expected_response_code
)
self
.
assertEquals
(
type
(
response_dict
),
DictType
)
if
expected_response_code
==
402
:
self
.
assertEquals
(
response_dict
,
{})
self
.
assertTrue
(
response_message
.
endswith
(
expected_response_message
),
"%s != %s"
%
(
response_message
,
expected_response_message
))
else
:
self
.
assertNotEquals
(
response_dict
[
'data'
],
response_dict_data
)
self
.
assertEquals
(
sorted
(
response_dict
.
keys
()),
response_dict_keys
)
self
.
assertEquals
(
response_message
,
expected_response_message
)
self
.
assertEquals
(
response_dict
[
'meta'
][
'MIMEType'
],
response_dict_meta
)
def
ConversionScenarioList
(
self
):
"""
Method used to convert files
...
...
@@ -129,3 +152,13 @@ class TestCase(unittest.TestCase):
for
scenario
in
scenarios
:
self
.
_testFaultGetMetadata
(
*
scenario
)
def
ConvertScenarioList
(
self
):
"""
Method to verify run_convert
must be overwrited into subclasses
"""
return
[]
def
runConvertScenarioList
(
self
,
scenarios
):
for
scenario
in
scenarios
:
self
.
_testRunConvert
(
*
scenario
)
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