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
1
Merge Requests
1
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
Jérome Perrin
cloudooo
Commits
7f93b479
Commit
7f93b479
authored
May 30, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor for using cloudoootestcase
parent
2e0fa871
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
76 deletions
+22
-76
cloudooo/handler/ffmpeg/tests/testAllVideoSupportedFormat.py
cloudooo/handler/ffmpeg/tests/testAllVideoSupportedFormat.py
+22
-76
No files found.
cloudooo/handler/ffmpeg/tests/testAllVideoSupportedFormat.py
View file @
7f93b479
...
...
@@ -26,83 +26,29 @@
#
##############################################################################
from
magic
import
Magic
from
xmlrpclib
import
ServerProxy
from
os.path
import
join
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
DAEMON
=
True
class
TestAllSupportedFormat
(
HandlerTestCase
):
"""Test XmlRpc Server. Needs cloudooo server started"""
def
afterSetUp
(
self
):
self
.
file_detector
=
Magic
(
mime
=
True
)
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
\
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
def
testAviFormat
(
self
):
"""Test convert file to avi format the reverse convertion"""
avi_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"avi"
)
# XXX this might expect 'video/avi' but magic only got 'video/x-msvideo'
self
.
assertEquals
(
avi_mimetype
,
'video/x-msvideo'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
testMp4Format
(
self
):
"""Test convert file to mp4 format the reverse convertion"""
mp4_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"mp4"
)
self
.
assertEquals
(
mp4_mimetype
,
'video/mp4'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
testWebMFormat
(
self
):
"""Test convert file to WebM format and the reverse convertion"""
webm_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"webm"
)
self
.
assertEquals
(
webm_mimetype
,
'video/webm'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
testFlvFormat
(
self
):
"""Test convert file to flash format the reverse convertion"""
flv_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"flv"
)
# XXX this might expect 'application/x-shockwave-flash' but magic only got
# 'video/x-flv'
self
.
assertEquals
(
flv_mimetype
,
'video/x-flv'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
testMpegFormat
(
self
):
"""Test convert file to Mpeg format the reverse convertion"""
mpeg_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"mpeg"
)
self
.
assertEquals
(
mpeg_mimetype
,
'video/mpeg'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
testMkvFormat
(
self
):
"""Test convert file to matroska format the reverse convertion"""
mkv_mimetype
,
ogv_mimetype
=
self
.
runTestForType
(
"mkv"
)
# XXX This might expect 'video/x-matroska' but magic only got
# 'application/octet-stream'
self
.
assertEquals
(
mkv_mimetype
,
'application/octet-stream'
)
# XXX This might expect 'video/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogv_mimetype
,
'application/ogg'
)
def
runTestForType
(
self
,
destination_format
):
"""Converts video files from ogv to destination_format and then to
ogv again"""
data
=
open
(
join
(
'data'
,
'test.ogv'
),
'r'
).
read
()
converted_data
=
self
.
proxy
.
convertFile
(
encodestring
(
data
),
"ogv"
,
destination_format
)
destination_mimetype
=
self
.
file_detector
.
from_buffer
(
decodestring
(
converted_data
))
ogv_data
=
self
.
proxy
.
convertFile
(
converted_data
,
destination_format
,
"ogv"
)
ogv_mimetype
=
self
.
file_detector
.
from_buffer
(
decodestring
(
ogv_data
))
return
(
destination_mimetype
,
ogv_mimetype
)
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
class
TestAllSupportedFormat
(
TestCase
):
def
ConversionScenarioList
(
self
):
return
[
# XXX this might expect 'video/avi' but magic only got
# 'video/x-msvideo'
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"avi"
,
"video/x-msvideo"
),
# XXX this might expect 'application/x-shockwave-flash' but magic
# only got 'video/x-flv'
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"flv"
,
"video/x-flv"
),
# XXX This might expect video/x-matroska but only
# got application/octet-stream
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"mkv"
,
"application/octet-stream"
),
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"mp4"
,
"video/mp4"
),
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"mpeg"
,
"video/mpeg"
),
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"webm"
,
"video/webm"
),
]
def
testAllSupportedFormat
(
self
):
self
.
runConversionList
(
self
.
ConversionScenarioList
())
def
test_suite
():
return
make_suite
(
TestAllSupportedFormat
)
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