1
0
mirror of synced 2024-11-05 17:08:52 +01:00

Test .odf support

This commit is contained in:
jvoisin 2018-04-23 00:24:39 +02:00
parent 73db16031b
commit 0fa184cb6f
3 changed files with 17 additions and 2 deletions

View File

@ -107,7 +107,8 @@ class LibreOfficeParser(ArchiveBasedAbstractParser):
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.presentation',
'application/vnd.oasis.opendocument.graphics',
'application/vnd.oasis.opendocument.chart'
'application/vnd.oasis.opendocument.chart',
'application/vnd.oasis.opendocument.formula',
}
def get_meta(self):

BIN
tests/data/dirty.odf Normal file

Binary file not shown.

View File

@ -328,7 +328,6 @@ class TestCleaning(unittest.TestCase):
os.remove('./tests/data/clean.bmp')
def test_torrent(self):
shutil.copy('./tests/data/dirty.torrent', './tests/data/clean.torrent')
p = torrent.TorrentParser('./tests/data/clean.torrent')
@ -343,3 +342,18 @@ class TestCleaning(unittest.TestCase):
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.torrent')
def test_odf(self):
shutil.copy('./tests/data/dirty.odf', './tests/data/clean.odf')
p = office.LibreOfficeParser('./tests/data/clean.odf')
meta = p.get_meta()
self.assertEqual(meta['meta:creation-date'], '2018-04-23T00:18:59.438231281')
ret = p.remove_all()
self.assertTrue(ret)
p = office.LibreOfficeParser('./tests/data/clean.odf.cleaned')
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.odf')