Commit 2a9aefac authored by Priscila Manhaes's avatar Priscila Manhaes

refactor for using cloudoootestcase

parent d5d117b1
...@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment