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, 14 insertions, 2 deletions
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py
index 4ac2678..8d7c252 100644
--- a/tests/test_corrupted_files.py
+++ b/tests/test_corrupted_files.py
@@ -86,14 +86,26 @@ class TestExplicitelyUnsupportedFiles(unittest.TestCase):
86 os.remove('./tests/data/clean.py') 86 os.remove('./tests/data/clean.py')
87 87
88 88
89class TestCorruptedContentTypesOffice(unittest.TestCase): 89class TestWrongContentTypesFileOffice(unittest.TestCase):
90 def test_office(self): 90 def test_office_incomplete(self):
91 shutil.copy('./tests/data/malformed_content_types.docx', './tests/data/clean.docx') 91 shutil.copy('./tests/data/malformed_content_types.docx', './tests/data/clean.docx')
92 p = office.MSOfficeParser('./tests/data/clean.docx') 92 p = office.MSOfficeParser('./tests/data/clean.docx')
93 self.assertIsNotNone(p) 93 self.assertIsNotNone(p)
94 self.assertFalse(p.remove_all()) 94 self.assertFalse(p.remove_all())
95 os.remove('./tests/data/clean.docx') 95 os.remove('./tests/data/clean.docx')
96 96
97 def test_office_broken(self):
98 shutil.copy('./tests/data/broken_xml_content_types.docx', './tests/data/clean.docx')
99 with self.assertRaises(ValueError):
100 office.MSOfficeParser('./tests/data/clean.docx')
101 os.remove('./tests/data/clean.docx')
102
103 def test_office_absent(self):
104 shutil.copy('./tests/data/no_content_types.docx', './tests/data/clean.docx')
105 with self.assertRaises(ValueError):
106 office.MSOfficeParser('./tests/data/clean.docx')
107 os.remove('./tests/data/clean.docx')
108
97class TestCorruptedFiles(unittest.TestCase): 109class TestCorruptedFiles(unittest.TestCase):
98 def test_pdf(self): 110 def test_pdf(self):
99 shutil.copy('./tests/data/dirty.png', './tests/data/clean.png') 111 shutil.copy('./tests/data/dirty.png', './tests/data/clean.png')