summaryrefslogtreecommitdiff
path: root/tests/test_libmat2.py
diff options
context:
space:
mode:
authorjvoisin2018-07-01 17:29:05 +0200
committerjvoisin2018-07-01 17:29:05 +0200
commit80fc4ffb40ea425e14697082e4b7e6a7cf0b5583 (patch)
treea08086235145cc0ce817df2eaed1cbac5faac9bc /tests/test_libmat2.py
parent177184ac671eebd2285561a39777dca2c9f70b04 (diff)
Remove the thumbnails from libreoffice files
Diffstat (limited to 'tests/test_libmat2.py')
-rw-r--r--tests/test_libmat2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index b34e7a4..3ea044f 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -105,6 +105,23 @@ class TestGetMeta(unittest.TestCase):
105 self.assertEqual(meta['meta:generator'], 'LibreOffice/3.3$Unix LibreOffice_project/330m19$Build-202') 105 self.assertEqual(meta['meta:generator'], 'LibreOffice/3.3$Unix LibreOffice_project/330m19$Build-202')
106 106
107 107
108class TestRemovingThumbnails(unittest.TestCase):
109 def test_odt(self):
110 shutil.copy('./tests/data/revision.odt', './tests/data/clean.odt')
111
112 zipin = zipfile.ZipFile(os.path.abspath('./tests/data/clean.odt'))
113 self.assertIn('Thumbnails/thumbnail.png', zipin.namelist())
114 zipin.close()
115
116 p = office.LibreOfficeParser('./tests/data/clean.odt')
117 self.assertTrue(p.remove_all())
118
119 zipin = zipfile.ZipFile(os.path.abspath('./tests/data/clean.cleaned.odt'))
120 self.assertNotIn('Thumbnails/thumbnail.png', zipin.namelist())
121 zipin.close()
122
123 os.remove('./tests/data/clean.cleaned.odt')
124
108class TestDeepCleaning(unittest.TestCase): 125class TestDeepCleaning(unittest.TestCase):
109 def __check_deep_meta(self, p): 126 def __check_deep_meta(self, p):
110 tempdir = tempfile.mkdtemp() 127 tempdir = tempfile.mkdtemp()