diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/data/revision.odt | bin | 0 -> 14458 bytes | |||
| -rw-r--r-- | tests/test_libmat2.py | 17 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/data/revision.odt b/tests/data/revision.odt new file mode 100644 index 0000000..d3b209b --- /dev/null +++ b/tests/data/revision.odt | |||
| Binary files differ | |||
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 | ||
| 108 | class 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 | |||
| 108 | class TestDeepCleaning(unittest.TestCase): | 125 | class 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() |
