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
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 @@
# 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
base64
import
encodestring
,
decodestring
from
magic
import
Magic
DAEMON
=
True
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
class
TestServer
(
Handler
TestCase
):
class
TestServer
(
TestCase
):
"""Test XmlRpc Server. Needs cloudooo server started"""
def
afterSetUp
(
self
):
"""Creates a connection with cloudooo server"""
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
\
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
def
ConversionScenarioList
(
self
):
return
[
(
join
(
'data'
,
'test.png'
),
"png"
,
"jpg"
,
"image/jpeg"
),
]
def
testConvertPNGtoJPG
(
self
):
"""Converts png to jpg"""
data
=
open
(
join
(
'data'
,
'test.png'
),
'r'
).
read
()
document
=
self
.
proxy
.
convertFile
(
encodestring
(
data
),
"png"
,
"jpg"
)
mime
=
Magic
(
mime
=
True
)
mimetype
=
mime
.
from_buffer
(
decodestring
(
document
))
self
.
assertEquals
(
mimetype
,
"image/jpeg"
)
self
.
runConversionList
(
self
.
ConversionScenarioList
())
def
GetMetadataScenarioList
(
self
):
return
[
(
join
(
'data'
,
'test.png'
),
"png"
,
dict
(
Compression
=
'Zip'
)),
]
def
testGetMetadataFromPNG
(
self
):
"""test if metadata are extracted correctly"""
data
=
open
(
join
(
'data'
,
'test.png'
),
'r'
).
read
()
metadata
=
self
.
proxy
.
getFileMetadataItemList
(
encodestring
(
data
),
"png"
)
self
.
assertEquals
(
metadata
[
"Compression"
],
'Zip'
)
self
.
runGetMetadataList
(
self
.
GetMetadataScenarioList
())
def
test_suite
():
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