Skip to content
Snippets Groups Projects
Commit 1b9ce34e authored by Alex Marchant's avatar Alex Marchant
Browse files

Add test that checks if comments.xml is removed without errors

parent 17e76ab6
No related branches found
No related tags found
No related merge requests found
Pipeline #210471 passed with warnings
File added
......@@ -858,3 +858,20 @@ class TestComplexOfficeFiles(unittest.TestCase):
os.remove(target)
os.remove(p.output_filename)
class TextDocx(unittest.TestCase):
def test_comment_xml_is_removed(self):
with zipfile.ZipFile('./tests/data/comment.docx') as zipin:
# Check if 'word/comments.xml' exists in the zip
self.assertIn('word/comments.xml', zipin.namelist())
shutil.copy('./tests/data/comment.docx', './tests/data/comment_clean.docx')
p = office.MSOfficeParser('./tests/data/comment_clean.docx')
self.assertTrue(p.remove_all())
with zipfile.ZipFile('./tests/data/comment_clean.cleaned.docx') as zipin:
# Check if 'word/comments.xml' exists in the zip
self.assertNotIn('word/comments.xml', zipin.namelist())
os.remove('./tests/data/comment_clean.docx')
os.remove('./tests/data/comment_clean.cleaned.docx')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment