Add a test for odg
This commit is contained in:
parent
0fa184cb6f
commit
cfc3a58550
@ -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
BIN
tests/data/dirty.odg
Normal file
Binary file not shown.
@ -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')
|
||||||
|
Loading…
Reference in New Issue
Block a user