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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Hide 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 @@
#
##############################################################################
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
from
cloudooo.tests.cloudoooTestCase
import
TestCase
,
make_suite
#DAEMON = True
class
TestServer
(
TestCase
):
class
TestServer
(
HandlerTestCase
):
"""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
)
self
.
data
=
open
(
join
(
'data'
,
'test.ogv'
),
'r'
).
read
()
def
ConversionScenarioList
(
self
):
return
[
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
"mpeg"
,
"video/mpeg"
),
]
def
testConvertVideo
(
self
):
"""Converts ogv video to mpeg format"""
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'
)
self
.
runConversionList
(
self
.
ConversionScenarioList
())
#from os.path import join
#from cloudooo.tests.cloudoooTestCase import TestCase, make_suite
def
GetMetadataScenarioList
(
self
):
return
[
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
dict
(
Data
=
''
,
ENCODER
=
'Lavf52.64'
+
'.2'
)),
]
#class TestServer(TestCase):
# 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
testGetMetadata
(
self
):
self
.
runGetMetadataList
(
self
.
GetMetadataScenarioList
())
#
def UpdateMetadataScenarioList(self):
#
return [
#
(join('data', 'test.ogv'), "ogv", dict(title='Server Set Metadata '+
#
'Test'), dict(Data='', ENCODER='Lavf52.64.2', title='Server Set Me'+
#
'tadata Test')),
#
]
def
UpdateMetadataScenarioList
(
self
):
return
[
(
join
(
'data'
,
'test.ogv'
),
"ogv"
,
dict
(
title
=
'Server Set Metadata '
+
'Test'
),
dict
(
Data
=
''
,
ENCODER
=
'Lavf52.64.2'
,
title
=
'Server Set Me'
+
'tadata Test'
)),
]
#
def testSetMetadata(self):
#
self.runUpdateMetadataList(self.UpdateMetadataScenarioList())
def
testSetMetadata
(
self
):
self
.
runUpdateMetadataList
(
self
.
UpdateMetadataScenarioList
())
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