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
Vincent Bechu
cloudooo
Commits
2a9aefac
Commit
2a9aefac
authored
May 30, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor for using cloudoootestcase
parent
d5d117b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
64 deletions
+22
-64
cloudooo/handler/ffmpeg/tests/testServer.py
cloudooo/handler/ffmpeg/tests/testServer.py
+22
-64
No files found.
cloudooo/handler/ffmpeg/tests/testServer.py
View file @
2a9aefac
...
@@ -26,79 +26,37 @@
...
@@ -26,79 +26,37 @@
#
#
##############################################################################
##############################################################################
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
(
TestCase
):
def
ConversionScenarioList
(
self
):
class
TestServer
(
HandlerTestCase
):
return
[
"""Test XmlRpc Server. Needs cloudooo server started"""
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"mpeg"
,
"video/mpeg"
),
]
def
afterSetUp
(
self
):
"""Creates a connection with cloudooo server"""
self
.
proxy
=
ServerProxy
(
"http://%s:%s/RPC2"
%
\
(
self
.
hostname
,
self
.
cloudooo_port
),
allow_none
=
True
)
self
.
data
=
open
(
join
(
'data'
,
'test.ogv'
),
'r'
).
read
()
def
testConvertVideo
(
self
):
def
testConvertVideo
(
self
):
"""Converts ogv video to mpeg format"""
self
.
runConversionList
(
self
.
ConversionScenarioList
())
video
=
self
.
proxy
.
convertFile
(
encodestring
(
self
.
data
),
"ogv"
,
"mpeg"
)
mime
=
Magic
(
mime
=
True
)
mimetype
=
mime
.
from_buffer
(
decodestring
(
video
))
self
.
assertEquals
(
mimetype
,
'video/mpeg'
)
def
testGetMetadata
(
self
):
"""test if metadata are extracted correctly"""
metadata
=
self
.
proxy
.
getFileMetadataItemList
(
encodestring
(
self
.
data
),
"ogv"
)
self
.
assertEquals
(
metadata
[
"Encoder"
],
'Lavf52.64.2'
)
def
testSetMetadata
(
self
):
"""Test if metadata is inserted correctly"""
new_data
=
self
.
proxy
.
updateFileMetadata
(
encodestring
(
self
.
data
),
"ogv"
,
{
"title"
:
"Server Set Metadata Test"
})
metadata
=
self
.
proxy
.
getFileMetadataItemList
(
new_data
,
"ogv"
)
self
.
assertEquals
(
metadata
[
"Encoder"
],
'Lavf52.64.2'
)
self
.
assertEquals
(
metadata
[
"Title"
],
'Server Set Metadata Test'
)
#from os.path import join
def
GetMetadataScenarioList
(
self
):
#from cloudooo.tests.cloudoooTestCase import TestCase, make_suite
return
[
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
dict
(
Data
=
''
,
ENCODER
=
'Lavf52.64'
+
'.2'
)),
]
#class TestServer(TestCase):
def
testGetMetadata
(
self
):
self
.
runGetMetadataList
(
self
.
GetMetadataScenarioList
())
# def ConversionScenarioList(self):
# return [
# (join('data', 'test.ogv'), "ogv", "mpeg", "video/mpeg"),
# ]
# def testConvertVideo(self):
# self.runConversionList(self.ConversionScenarioList())
# def GetMetadataScenarioList(self):
# return [
# (join('data', 'test.ogv'), "ogv", dict(Data='', ENCODER='Lavf52.64'+
# '.2')),
# ]
# def testGetMetadata(self):
# self.runGetMetadataList(self.GetMetadataScenarioList())
#
def UpdateMetadataScenarioList(self):
def
UpdateMetadataScenarioList
(
self
):
#
return [
return
[
#
(join('data', 'test.ogv'), "ogv", dict(title='Server Set Metadata '+
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
dict
(
title
=
'Server Set Metadata '
+
#
'Test'), dict(Data='', ENCODER='Lavf52.64.2', title='Server Set Me'+
'Test'
),
dict
(
Data
=
''
,
ENCODER
=
'Lavf52.64.2'
,
title
=
'Server Set Me'
+
#
'tadata Test')),
'tadata Test'
)),
#
]
]
#
def testSetMetadata(self):
def
testSetMetadata
(
self
):
#
self.runUpdateMetadataList(self.UpdateMetadataScenarioList())
self
.
runUpdateMetadataList
(
self
.
UpdateMetadataScenarioList
())
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