From 02f7605ac124ed42bd9f3f156ee40877fe3c6b42 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 27 Jun 2018 23:10:53 +0200 Subject: MAT2 is now cleaning revisions from odt files! --- tests/test_libmat2.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/test_libmat2.py') 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): os.remove('./tests/data/clean.cleaned.odt') + +class TestRevisionsCleaning(unittest.TestCase): + def test_libreoffice(self): + with zipfile.ZipFile('./tests/data/revision.odt') as zipin: + c = zipin.open('content.xml') + r = c.read() + self.assertIn(b'tracked-changes', r) + + shutil.copy('./tests/data/revision.odt', './tests/data/clean.odt') + p = office.LibreOfficeParser('./tests/data/clean.odt') + self.assertTrue(p.remove_all()) + + with zipfile.ZipFile('./tests/data/clean.cleaned.odt') as zipin: + c = zipin.open('content.xml') + r = c.read() + self.assertNotIn(b'tracked-changes', r) + + os.remove('./tests/data/clean.odt') + os.remove('./tests/data/clean.cleaned.odt') + + class TestDeepCleaning(unittest.TestCase): def __check_deep_meta(self, p): tempdir = tempfile.mkdtemp() -- cgit v1.3