Optimize the handling of problematic files
This commit is contained in:
parent
44f267a596
commit
38df679a88
5 changed files with 36 additions and 29 deletions
|
@ -204,3 +204,14 @@ class TestCorruptedFiles(unittest.TestCase):
|
|||
p = video.AVIParser('./tests/data/clean.avi')
|
||||
self.assertFalse(p.remove_all())
|
||||
os.remove('./tests/data/clean.avi')
|
||||
|
||||
def test_avi_injection(self):
|
||||
try:
|
||||
video._get_ffmpeg_path()
|
||||
except RuntimeError:
|
||||
raise unittest.SkipTest
|
||||
|
||||
shutil.copy('./tests/data/dirty.torrent', './tests/data/--output.avi')
|
||||
p = video.AVIParser('./tests/data/--output.avi')
|
||||
self.assertFalse(p.remove_all())
|
||||
os.remove('./tests/data/--output.avi')
|
||||
|
|
|
@ -46,10 +46,23 @@ class TestParameterInjection(unittest.TestCase):
|
|||
shutil.copy('./tests/data/dirty.avi', './--output')
|
||||
p = video.AVIParser('--output')
|
||||
meta = p.get_meta()
|
||||
print(meta)
|
||||
self.assertEqual(meta['Software'], 'MEncoder SVN-r33148-4.0.1')
|
||||
os.remove('--output')
|
||||
|
||||
def test_ffmpeg_injection_complete_path(self):
|
||||
try:
|
||||
video._get_ffmpeg_path()
|
||||
except RuntimeError:
|
||||
raise unittest.SkipTest
|
||||
|
||||
shutil.copy('./tests/data/dirty.avi', './tests/data/ --output.avi')
|
||||
p = video.AVIParser('./tests/data/ --output.avi')
|
||||
meta = p.get_meta()
|
||||
self.assertEqual(meta['Software'], 'MEncoder SVN-r33148-4.0.1')
|
||||
self.assertTrue(p.remove_all())
|
||||
os.remove('./tests/data/ --output.avi')
|
||||
os.remove('./tests/data/ --output.cleaned.avi')
|
||||
|
||||
|
||||
class TestUnsupportedEmbeddedFiles(unittest.TestCase):
|
||||
def test_odt_with_svg(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue