diff options
| author | jvoisin | 2018-10-22 19:12:39 +0200 |
|---|---|---|
| committer | jvoisin | 2018-10-23 13:49:58 +0200 |
| commit | 38df679a88a19db3a4a82fdb8e20a42c9a53d1a1 (patch) | |
| tree | e7eea36bae3341a97e2b9a730964cfe632fb74f5 /tests | |
| parent | 44f267a5964ea8dbb59c26c319e43fad84afb45a (diff) | |
Optimize the handling of problematic files
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_corrupted_files.py | 11 | ||||
| -rw-r--r-- | tests/test_libmat2.py | 15 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py index 490ea42..82c6c3b 100644 --- a/tests/test_corrupted_files.py +++ b/tests/test_corrupted_files.py | |||
| @@ -204,3 +204,14 @@ class TestCorruptedFiles(unittest.TestCase): | |||
| 204 | p = video.AVIParser('./tests/data/clean.avi') | 204 | p = video.AVIParser('./tests/data/clean.avi') |
| 205 | self.assertFalse(p.remove_all()) | 205 | self.assertFalse(p.remove_all()) |
| 206 | os.remove('./tests/data/clean.avi') | 206 | os.remove('./tests/data/clean.avi') |
| 207 | |||
| 208 | def test_avi_injection(self): | ||
| 209 | try: | ||
| 210 | video._get_ffmpeg_path() | ||
| 211 | except RuntimeError: | ||
| 212 | raise unittest.SkipTest | ||
| 213 | |||
| 214 | shutil.copy('./tests/data/dirty.torrent', './tests/data/--output.avi') | ||
| 215 | p = video.AVIParser('./tests/data/--output.avi') | ||
| 216 | self.assertFalse(p.remove_all()) | ||
| 217 | os.remove('./tests/data/--output.avi') | ||
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 241c6eb..f5fc9e8 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -46,10 +46,23 @@ class TestParameterInjection(unittest.TestCase): | |||
| 46 | shutil.copy('./tests/data/dirty.avi', './--output') | 46 | shutil.copy('./tests/data/dirty.avi', './--output') |
| 47 | p = video.AVIParser('--output') | 47 | p = video.AVIParser('--output') |
| 48 | meta = p.get_meta() | 48 | meta = p.get_meta() |
| 49 | print(meta) | ||
| 50 | self.assertEqual(meta['Software'], 'MEncoder SVN-r33148-4.0.1') | 49 | self.assertEqual(meta['Software'], 'MEncoder SVN-r33148-4.0.1') |
| 51 | os.remove('--output') | 50 | os.remove('--output') |
| 52 | 51 | ||
| 52 | def test_ffmpeg_injection_complete_path(self): | ||
| 53 | try: | ||
| 54 | video._get_ffmpeg_path() | ||
| 55 | except RuntimeError: | ||
| 56 | raise unittest.SkipTest | ||
| 57 | |||
| 58 | shutil.copy('./tests/data/dirty.avi', './tests/data/ --output.avi') | ||
| 59 | p = video.AVIParser('./tests/data/ --output.avi') | ||
| 60 | meta = p.get_meta() | ||
| 61 | self.assertEqual(meta['Software'], 'MEncoder SVN-r33148-4.0.1') | ||
| 62 | self.assertTrue(p.remove_all()) | ||
| 63 | os.remove('./tests/data/ --output.avi') | ||
| 64 | os.remove('./tests/data/ --output.cleaned.avi') | ||
| 65 | |||
| 53 | 66 | ||
| 54 | class TestUnsupportedEmbeddedFiles(unittest.TestCase): | 67 | class TestUnsupportedEmbeddedFiles(unittest.TestCase): |
| 55 | def test_odt_with_svg(self): | 68 | def test_odt_with_svg(self): |
