[Erp5-report] r43858 priscila.manhaes - /erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/...
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 1 15:45:37 CET 2011
Author: priscila.manhaes
Date: Tue Mar 1 15:45:37 2011
New Revision: 43858
URL: http://svn.erp5.org?rev=43858&view=rev
Log:
Refactor repeated code into the tests
Modified:
erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py
Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py?rev=43858&r1=43857&r2=43858&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/ffmpeg/tests/testAllSupportedFormat.py [utf8] Tue Mar 1 15:45:37 2011
@@ -34,20 +34,24 @@ from cloudooo.handler.tests.handlerTestC
file_detector = Magic(mime=True)
-class TestAllFormats(HandlerTestCase):
+class TestAllSupportedFormats(HandlerTestCase):
def afterSetUp(self):
self.data = open("./data/test.ogv").read()
self.kw = dict(env=dict(PATH=self.env_path))
self.input = FFMPEGHandler(self.tmp_url, self.data, "ogv", **self.kw)
+ def afterFormat(self, output_data):
+ output = FFMPEGHandler(self.tmp_url, output_data, "avi", **self.kw)
+ input_data = output.convert("ogv")
+ input_format = file_detector.from_buffer(input_data)
+ return input_format
+
def testAviFormat(self):
"""Test convert file to avi format the reverse convertion"""
output_data = self.input.convert("avi")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "avi", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'video/avi')
self.assertEquals(input_format, 'video/ogg')
@@ -55,9 +59,7 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to mp4 format the reverse convertion"""
output_data = self.input.convert("mp4")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "mp4", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'video/mp4')
self.assertEquals(input_format, 'video/ogg')
@@ -65,9 +67,7 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to WebM format and the reverse convertion"""
output_data = self.input.convert("webm")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "webm", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'video/webm')
self.assertEquals(input_format, 'video/ogg')
@@ -75,9 +75,7 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to flash format the reverse convertion"""
output_data = self.input.convert("flv")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "flv", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'application/x-shockwave-flash')
self.assertEquals(input_format, 'video/ogg')
@@ -85,9 +83,7 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to Mpeg format the reverse convertion"""
output_data = self.input.convert("mpeg")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "mpeg", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'video/mpeg')
self.assertEquals(input_format, 'video/ogg')
@@ -95,9 +91,7 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to matroska format the reverse convertion"""
output_data = self.input.convert("mkv")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "mkv", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'video/x-matroska')
self.assertEquals(input_format, 'video/ogg')
@@ -105,12 +99,10 @@ class TestAllFormats(HandlerTestCase):
"""Test convert file to ogg format the reverse convertion"""
output_data = self.input.convert("ogg")
output_format = file_detector.from_buffer(output_data)
- output = FFMPEGHandler(self.tmp_url, output_data, "ogg", **self.kw)
- input_data = output.convert("ogv")
- input_format = file_detector.from_buffer(input_data)
+ input_format = self.afterFormat(output_data)
self.assertEquals(output_format, 'application/ogg')
self.assertEquals(input_format, 'video/ogg')
def test_suite():
- return make_suite(TestAllFormats)
+ return make_suite(TestAllSupportedFormats)
More information about the Erp5-report
mailing list