Commit a1b6192c authored by Priscila Manhaes's avatar Priscila Manhaes

Added failure tests for corrupt files

parent abeb2a8c
......@@ -41,6 +41,20 @@ class TestServer(TestCase):
"""Converts ogv video to mpeg format"""
self.runConversionList(self.ConversionScenarioList())
def FaultConversionScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', '', ''),
# Try convert one video for a invalid format
(open(join('data', 'test.ogv')).read(), 'ogv', 'xyz'),
# Try convert one video to format not possible
(open(join('data', 'test.ogv')).read(), 'ogv', 'moov'),
]
def testFaultConversion(self):
"""Test fail convertion of Invalid video files"""
self.runFaultConversionList(self.FaultConversionScenarioList())
def GetMetadataScenarioList(self):
return [
(join('data', 'test.ogv'), "ogv", dict(Data='', Encoder='Lavf52.64'+
......@@ -51,6 +65,17 @@ class TestServer(TestCase):
"""test if metadata are extracted correctly"""
self.runGetMetadataList(self.GetMetadataScenarioList())
def FaultGetMetadataScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', ''),
]
def testFaultGetMetadata(self):
"""Test getMetadata from invalid video files"""
self.runFaultGetMetadataList(self.FaultGetMetadataScenarioList())
def UpdateMetadataScenarioList(self):
return [
(join('data', 'test.ogv'), "ogv", dict(Title='Server Set Metadata '+
......
......@@ -41,6 +41,19 @@ class TestServer(TestCase):
"""Converts png to jpg"""
self.runConversionList(self.ConversionScenarioList())
def FaultConversionScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', '', ''),
# Try convert one video for a invalid format
(open(join('data', 'test.png')).read(), 'png', 'xyz'),
# Try convert one video to format not possible
(open(join('data', 'test.png')).read(), 'png', '8bim'),
]
def testFaultConversion(self):
"""Test fail convertion of Invalid image files"""
def GetMetadataScenarioList(self):
return [
(join('data', 'test.png'), "png", dict(Compression='Zip')),
......@@ -50,5 +63,16 @@ class TestServer(TestCase):
"""test if metadata are extracted correctly"""
self.runGetMetadataList(self.GetMetadataScenarioList())
def FaultGetMetadataScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', ''),
]
def testFaultGetMetadata(self):
"""Test getMetadata from invalid image file"""
self.runFaultGetMetadataList(self.FaultGetMetadataScenarioList())
def test_suite():
return make_suite(TestServer)
......@@ -42,6 +42,21 @@ class TestServer(TestCase):
"""Converts pdf to txt"""
self.runConversionList(self.ConversionScenarioList())
def FaultConversionScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', '', ''),
# Try convert one video for a invalid format
(open(join('data', 'test.pdf')).read(), 'pdf', 'xyz'),
# Try convert one video to format not possible
(open(join('data', 'test.pdf')).read(), 'pdf', 'ogv'),
]
def testFaultConversion(self):
"""Test fail convertion of Invalid pdf files"""
self.runFaultConversionList(self.FaultConversionScenarioList())
def GetMetadataScenarioList(self):
return [
(join('data', 'test.pdf'), "pdf", dict(title='Free Cloud Alliance'+
......@@ -52,6 +67,16 @@ class TestServer(TestCase):
"""test if metadata are extracted correctly"""
self.runGetMetadataList(self.GetMetadataScenarioList())
def FaultGetMetadataScenarioList(self):
return [
# Test to verify if server fail when a empty string is sent
('', ''),
]
def testFaultGetMetadata(self):
"""Test getMetadata from invalid pdf file"""
self.runFaultGetMetadataList(self.FaultGetMetadataScenarioList())
def UpdateMetadataScenarioList(self):
return [
(join('data', 'test.pdf'), "pdf", dict(producer='Cloudooo')),
......
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