summaryrefslogtreecommitdiff
path: root/tests/test_corrupted_files.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_corrupted_files.py')
-rw-r--r--tests/test_corrupted_files.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py
index 72d124f..aee1530 100644
--- a/tests/test_corrupted_files.py
+++ b/tests/test_corrupted_files.py
@@ -53,16 +53,21 @@ class TestUnsupportedFiles(unittest.TestCase):
53class TestCorruptedEmbedded(unittest.TestCase): 53class TestCorruptedEmbedded(unittest.TestCase):
54 def test_docx(self): 54 def test_docx(self):
55 shutil.copy('./tests/data/embedded_corrupted.docx', './tests/data/clean.docx') 55 shutil.copy('./tests/data/embedded_corrupted.docx', './tests/data/clean.docx')
56 parser, mimetype = parser_factory.get_parser('./tests/data/clean.docx') 56 parser, _ = parser_factory.get_parser('./tests/data/clean.docx')
57 self.assertFalse(parser.remove_all()) 57 self.assertFalse(parser.remove_all())
58 self.assertIsNotNone(parser.get_meta()) 58 self.assertIsNotNone(parser.get_meta())
59 os.remove('./tests/data/clean.docx') 59 os.remove('./tests/data/clean.docx')
60 60
61 def test_odt(self): 61 def test_odt(self):
62 expected = {
63 'create_system': 'Weird',
64 'date_time': '2018-06-10 17:18:18',
65 'meta.xml': 'harmful content'
66 }
62 shutil.copy('./tests/data/embedded_corrupted.odt', './tests/data/clean.odt') 67 shutil.copy('./tests/data/embedded_corrupted.odt', './tests/data/clean.odt')
63 parser, mimetype = parser_factory.get_parser('./tests/data/clean.odt') 68 parser, _ = parser_factory.get_parser('./tests/data/clean.odt')
64 self.assertFalse(parser.remove_all()) 69 self.assertFalse(parser.remove_all())
65 self.assertEqual(parser.get_meta(), {'create_system': 'Weird', 'date_time': '2018-06-10 17:18:18', 'meta.xml': 'harmful content'}) 70 self.assertEqual(parser.get_meta(), expected)
66 os.remove('./tests/data/clean.odt') 71 os.remove('./tests/data/clean.odt')
67 72
68 73
@@ -90,7 +95,7 @@ class TestCorruptedFiles(unittest.TestCase):
90 95
91 def test_png2(self): 96 def test_png2(self):
92 shutil.copy('./tests/test_libmat2.py', './tests/clean.png') 97 shutil.copy('./tests/test_libmat2.py', './tests/clean.png')
93 parser, mimetype = parser_factory.get_parser('./tests/clean.png') 98 parser, _ = parser_factory.get_parser('./tests/clean.png')
94 self.assertIsNone(parser) 99 self.assertIsNone(parser)
95 os.remove('./tests/clean.png') 100 os.remove('./tests/clean.png')
96 101
@@ -134,7 +139,8 @@ class TestCorruptedFiles(unittest.TestCase):
134 139
135 def test_bmp(self): 140 def test_bmp(self):
136 shutil.copy('./tests/data/dirty.png', './tests/data/clean.bmp') 141 shutil.copy('./tests/data/dirty.png', './tests/data/clean.bmp')
137 harmless.HarmlessParser('./tests/data/clean.bmp') 142 ret = harmless.HarmlessParser('./tests/data/clean.bmp')
143 self.assertIsNotNone(ret)
138 os.remove('./tests/data/clean.bmp') 144 os.remove('./tests/data/clean.bmp')
139 145
140 def test_docx(self): 146 def test_docx(self):