1
0
mirror of synced 2024-11-22 01:04:23 +01:00

Add a test for odg

This commit is contained in:
jvoisin 2018-04-23 00:28:36 +02:00
parent 0fa184cb6f
commit cfc3a58550
3 changed files with 17 additions and 0 deletions

View File

@ -109,6 +109,7 @@ class LibreOfficeParser(ArchiveBasedAbstractParser):
'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.graphics',
'application/vnd.oasis.opendocument.chart', 'application/vnd.oasis.opendocument.chart',
'application/vnd.oasis.opendocument.formula', 'application/vnd.oasis.opendocument.formula',
'application/vnd.oasis.opendocument.image',
} }
def get_meta(self): def get_meta(self):

BIN
tests/data/dirty.odg Normal file

Binary file not shown.

View File

@ -357,3 +357,19 @@ class TestCleaning(unittest.TestCase):
self.assertEqual(p.get_meta(), {}) self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.odf') os.remove('./tests/data/clean.odf')
def test_odg(self):
shutil.copy('./tests/data/dirty.odg', './tests/data/clean.odg')
p = office.LibreOfficeParser('./tests/data/clean.odg')
meta = p.get_meta()
self.assertEqual(meta['dc:date'], '2018-04-23T00:26:59.385838550')
ret = p.remove_all()
self.assertTrue(ret)
p = office.LibreOfficeParser('./tests/data/clean.odg.cleaned')
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.odg')