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
ad8a6afb
Commit
ad8a6afb
authored
May 31, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to use cloudoootestcase
parent
49b6a4c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
cloudooo/handler/imagemagick/tests/testServer.py
cloudooo/handler/imagemagick/tests/testServer.py
+13
-23
No files found.
cloudooo/handler/imagemagick/tests/testServer.py
View file @
ad8a6afb
...
@@ -25,40 +25,30 @@
...
@@ -25,40 +25,30 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
from
xmlrpclib
import
ServerProxy
from
os.path
import
join
from
os.path
import
join
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
from
magic
import
Magic
DAEMON
=
True
class
TestServer
(
Handler
TestCase
):
class
TestServer
(
TestCase
):
"""Test XmlRpc Server. Needs cloudooo server started"""
"""Test XmlRpc Server. Needs cloudooo server started"""
def
afterSetUp
(
self
):
def
ConversionScenarioList
(
self
):
"""Creates a connection with cloudooo server"""
return
[
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
\
(
join
(
'data'
,
'test.png'
),
"png"
,
"jpg"
,
"image/jpeg"
),
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
]
def
testConvertPNGtoJPG
(
self
):
def
testConvertPNGtoJPG
(
self
):
"""Converts png to jpg"""
"""Converts png to jpg"""
data
=
open
(
join
(
'data'
,
'test.png'
),
'r'
).
read
()
self
.
runConversionList
(
self
.
ConversionScenarioList
())
document
=
self
.
proxy
.
convertFile
(
encodestring
(
data
),
"png"
,
def
GetMetadataScenarioList
(
self
):
"jpg"
)
return
[
mime
=
Magic
(
mime
=
True
)
(
join
(
'data'
,
'test.png'
),
"png"
,
dict
(
Compression
=
'Zip'
)),
mimetype
=
mime
.
from_buffer
(
decodestring
(
document
))
]
self
.
assertEquals
(
mimetype
,
"image/jpeg"
)
def
testGetMetadataFromPNG
(
self
):
def
testGetMetadataFromPNG
(
self
):
"""test if metadata are extracted correctly"""
"""test if metadata are extracted correctly"""
data
=
open
(
join
(
'data'
,
'test.png'
),
'r'
).
read
()
self
.
runGetMetadataList
(
self
.
GetMetadataScenarioList
())
metadata
=
self
.
proxy
.
getFileMetadataItemList
(
encodestring
(
data
),
"png"
)
self
.
assertEquals
(
metadata
[
"Compression"
],
'Zip'
)
def
test_suite
():
def
test_suite
():
return
make_suite
(
TestServer
)
return
make_suite
(
TestServer
)
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