diff options
| author | jvoisin | 2018-06-27 23:10:53 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-01 21:09:20 +0200 |
| commit | 02f7605ac124ed42bd9f3f156ee40877fe3c6b42 (patch) | |
| tree | f2dbd634d91c6c808a1269695c2abd465e3d0333 /tests/test_libmat2.py | |
| parent | 80fc4ffb40ea425e14697082e4b7e6a7cf0b5583 (diff) | |
MAT2 is now cleaning revisions from odt files!
Diffstat (limited to 'tests/test_libmat2.py')
| -rw-r--r-- | tests/test_libmat2.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 3ea044f..1573790 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -122,6 +122,27 @@ class TestRemovingThumbnails(unittest.TestCase): | |||
| 122 | 122 | ||
| 123 | os.remove('./tests/data/clean.cleaned.odt') | 123 | os.remove('./tests/data/clean.cleaned.odt') |
| 124 | 124 | ||
| 125 | |||
| 126 | class TestRevisionsCleaning(unittest.TestCase): | ||
| 127 | def test_libreoffice(self): | ||
| 128 | with zipfile.ZipFile('./tests/data/revision.odt') as zipin: | ||
| 129 | c = zipin.open('content.xml') | ||
| 130 | r = c.read() | ||
| 131 | self.assertIn(b'tracked-changes', r) | ||
| 132 | |||
| 133 | shutil.copy('./tests/data/revision.odt', './tests/data/clean.odt') | ||
| 134 | p = office.LibreOfficeParser('./tests/data/clean.odt') | ||
| 135 | self.assertTrue(p.remove_all()) | ||
| 136 | |||
| 137 | with zipfile.ZipFile('./tests/data/clean.cleaned.odt') as zipin: | ||
| 138 | c = zipin.open('content.xml') | ||
| 139 | r = c.read() | ||
| 140 | self.assertNotIn(b'tracked-changes', r) | ||
| 141 | |||
| 142 | os.remove('./tests/data/clean.odt') | ||
| 143 | os.remove('./tests/data/clean.cleaned.odt') | ||
| 144 | |||
| 145 | |||
| 125 | class TestDeepCleaning(unittest.TestCase): | 146 | class TestDeepCleaning(unittest.TestCase): |
| 126 | def __check_deep_meta(self, p): | 147 | def __check_deep_meta(self, p): |
| 127 | tempdir = tempfile.mkdtemp() | 148 | tempdir = tempfile.mkdtemp() |
