summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/embedded_corrupted.docxbin0 -> 223581 bytes
-rw-r--r--tests/data/embedded_corrupted.odtbin0 -> 217315 bytes
-rw-r--r--tests/test_corrupted_files.py15
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/data/embedded_corrupted.docx b/tests/data/embedded_corrupted.docx
new file mode 100644
index 0000000..989bdb8
--- /dev/null
+++ b/tests/data/embedded_corrupted.docx
Binary files differ
diff --git a/tests/data/embedded_corrupted.odt b/tests/data/embedded_corrupted.odt
new file mode 100644
index 0000000..1e4a844
--- /dev/null
+++ b/tests/data/embedded_corrupted.odt
Binary files differ
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py
index a77acbc..2bb1c76 100644
--- a/tests/test_corrupted_files.py
+++ b/tests/test_corrupted_files.py
@@ -15,6 +15,21 @@ class TestUnsupportedFiles(unittest.TestCase):
15 self.assertEqual(parser, None) 15 self.assertEqual(parser, None)
16 os.remove('./tests/clean.py') 16 os.remove('./tests/clean.py')
17 17
18class TestCorruptedEmbedded(unittest.TestCase):
19 def test_docx(self):
20 shutil.copy('./tests/data/embedded_corrupted.docx', './tests/data/clean.docx')
21 parser, mimetype = parser_factory.get_parser('./tests/data/clean.docx')
22 self.assertFalse(parser.remove_all())
23 self.assertIsNotNone(parser.get_meta())
24 os.remove('./tests/data/clean.docx')
25
26 def test_odt(self):
27 shutil.copy('./tests/data/embedded_corrupted.odt', './tests/data/clean.odt')
28 parser, mimetype = parser_factory.get_parser('./tests/data/clean.odt')
29 self.assertFalse(parser.remove_all())
30 self.assertEqual(parser.get_meta(), {'create_system': 'Weird', 'date_time': '2018-06-10 17:18:18', 'meta.xml': 'harmful content'})
31 os.remove('./tests/data/clean.odt')
32
18 33
19class TestExplicitelyUnsupportedFiles(unittest.TestCase): 34class TestExplicitelyUnsupportedFiles(unittest.TestCase):
20 def test_pdf(self): 35 def test_pdf(self):