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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
cloudooo
Commits
2e0fa871
Commit
2e0fa871
authored
May 30, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to use cloudoootestcase
parent
a92728b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
48 deletions
+10
-48
cloudooo/handler/ffmpeg/tests/testAllAudioSupportedFormat.py
cloudooo/handler/ffmpeg/tests/testAllAudioSupportedFormat.py
+10
-48
No files found.
cloudooo/handler/ffmpeg/tests/testAllAudioSupportedFormat.py
View file @
2e0fa871
...
@@ -26,59 +26,21 @@
...
@@ -26,59 +26,21 @@
#
#
##############################################################################
##############################################################################
from
magic
import
Magic
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
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
DAEMON
=
True
class
TestAllSupportedFormat
(
Handler
TestCase
):
class
TestAllSupportedFormat
(
TestCase
):
def
afterSetUp
(
self
):
def
ConversionScenarioList
(
self
):
self
.
file_detector
=
Magic
(
mime
=
True
)
return
[
# XXX This might expect audio/octet-stream but only got audio/mpeg
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
\
(
join
(
'data'
,
'test.ogg'
),
"ogg"
,
"mp3"
,
"audio/mpeg"
),
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
(
join
(
'data'
,
'test.ogg'
),
"ogg"
,
"wav"
,
"audio/x-wav"
),
(
join
(
'data'
,
'test.ogg'
),
"ogg"
,
"midi"
,
"audio/rtp-midi"
),
]
def
testMP3Format
(
self
):
def
testAllSupportedFormat
(
self
):
"""Test convert file to mp3 format the reverse convertion"""
self
.
runConversionList
(
self
.
ConversionScenarioList
())
mp3_mimetype
,
ogg_mimetype
=
self
.
runTestForType
(
"mp3"
)
# XXX This might expect 'audio/mpeg' but magic only got
# 'application/octet-stream'
self
.
assertEquals
(
mp3_mimetype
,
'application/octet-stream'
)
# XXX This might expect 'audio/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogg_mimetype
,
'application/ogg'
)
def
testWAVFormat
(
self
):
"""Test convert file to wav format the reverse convertion"""
wav_mimetype
,
ogg_mimetype
=
self
.
runTestForType
(
"wav"
)
# XXX this might expect 'audio/vnd.wave' but magic only got 'audio/x-wav'
self
.
assertEquals
(
wav_mimetype
,
'audio/x-wav'
)
# XXX This might expect 'audio/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogg_mimetype
,
'application/ogg'
)
def
testMIDFormat
(
self
):
"""Test convert file to mid format and the reverse convertion"""
mid_mimetype
,
ogg_mimetype
=
self
.
runTestForType
(
"mid"
)
self
.
assertEquals
(
mid_mimetype
,
'audio/rtp-midi'
)
# XXX This might expect 'audio/ogg' but magic only got 'application/ogg'
self
.
assertEquals
(
ogg_mimetype
,
'application/ogg'
)
def
runTestForType
(
self
,
destination_format
):
"""Converts audio files from ogg to destination_format and then to
ogg again"""
data
=
open
(
join
(
'data'
,
'test.ogg'
),
'r'
).
read
()
converted_data
=
self
.
proxy
.
convertFile
(
encodestring
(
data
),
"ogg"
,
destination_format
)
destination_mimetype
=
self
.
file_detector
.
from_buffer
(
decodestring
(
converted_data
))
ogg_data
=
self
.
proxy
.
convertFile
(
converted_data
,
destination_format
,
"ogg"
)
ogg_mimetype
=
self
.
file_detector
.
from_buffer
(
decodestring
(
ogg_data
))
return
(
destination_mimetype
,
ogg_mimetype
)
def
test_suite
():
def
test_suite
():
...
...
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