diff options
| author | jvoisin | 2018-07-01 23:11:10 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-01 23:16:14 +0200 |
| commit | bee56a57ce0f45c51386423d508ba06836be366e (patch) | |
| tree | 7206bda3603ddd9864dce5f916713bb42984963c /tests/test_libmat2.py | |
| parent | 02f7605ac124ed42bd9f3f156ee40877fe3c6b42 (diff) | |
Remove docx revisions
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 1573790..4df6385 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -121,6 +121,7 @@ class TestRemovingThumbnails(unittest.TestCase): | |||
| 121 | zipin.close() | 121 | zipin.close() |
| 122 | 122 | ||
| 123 | os.remove('./tests/data/clean.cleaned.odt') | 123 | os.remove('./tests/data/clean.cleaned.odt') |
| 124 | os.remove('./tests/data/clean.odt') | ||
| 124 | 125 | ||
| 125 | 126 | ||
| 126 | class TestRevisionsCleaning(unittest.TestCase): | 127 | class TestRevisionsCleaning(unittest.TestCase): |
| @@ -142,6 +143,26 @@ class TestRevisionsCleaning(unittest.TestCase): | |||
| 142 | os.remove('./tests/data/clean.odt') | 143 | os.remove('./tests/data/clean.odt') |
| 143 | os.remove('./tests/data/clean.cleaned.odt') | 144 | os.remove('./tests/data/clean.cleaned.odt') |
| 144 | 145 | ||
| 146 | def test_msoffice(self): | ||
| 147 | with zipfile.ZipFile('./tests/data/revision.docx') as zipin: | ||
| 148 | c = zipin.open('word/document.xml') | ||
| 149 | content = c.read() | ||
| 150 | r = b'<w:ins w:id="1" w:author="Unknown Author" w:date="2018-06-28T23:48:00Z">' | ||
| 151 | self.assertIn(r, content) | ||
| 152 | |||
| 153 | shutil.copy('./tests/data/revision.docx', './tests/data/revision_clean.docx') | ||
| 154 | p = office.MSOfficeParser('./tests/data/revision_clean.docx') | ||
| 155 | self.assertTrue(p.remove_all()) | ||
| 156 | |||
| 157 | with zipfile.ZipFile('./tests/data/revision_clean.cleaned.docx') as zipin: | ||
| 158 | c = zipin.open('word/document.xml') | ||
| 159 | content = c.read() | ||
| 160 | r = b'<w:ins w:id="1" w:author="Unknown Author" w:date="2018-06-28T23:48:00Z">' | ||
| 161 | self.assertNotIn(r, content) | ||
| 162 | |||
| 163 | os.remove('./tests/data/revision_clean.docx') | ||
| 164 | os.remove('./tests/data/revision_clean.cleaned.docx') | ||
| 165 | |||
| 145 | 166 | ||
| 146 | class TestDeepCleaning(unittest.TestCase): | 167 | class TestDeepCleaning(unittest.TestCase): |
| 147 | def __check_deep_meta(self, p): | 168 | def __check_deep_meta(self, p): |
