Test .odf support
This commit is contained in:
parent
73db16031b
commit
0fa184cb6f
@ -107,7 +107,8 @@ class LibreOfficeParser(ArchiveBasedAbstractParser):
|
|||||||
'application/vnd.oasis.opendocument.spreadsheet',
|
'application/vnd.oasis.opendocument.spreadsheet',
|
||||||
'application/vnd.oasis.opendocument.presentation',
|
'application/vnd.oasis.opendocument.presentation',
|
||||||
'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',
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_meta(self):
|
def get_meta(self):
|
||||||
|
BIN
tests/data/dirty.odf
Normal file
BIN
tests/data/dirty.odf
Normal file
Binary file not shown.
@ -328,7 +328,6 @@ class TestCleaning(unittest.TestCase):
|
|||||||
|
|
||||||
os.remove('./tests/data/clean.bmp')
|
os.remove('./tests/data/clean.bmp')
|
||||||
|
|
||||||
|
|
||||||
def test_torrent(self):
|
def test_torrent(self):
|
||||||
shutil.copy('./tests/data/dirty.torrent', './tests/data/clean.torrent')
|
shutil.copy('./tests/data/dirty.torrent', './tests/data/clean.torrent')
|
||||||
p = torrent.TorrentParser('./tests/data/clean.torrent')
|
p = torrent.TorrentParser('./tests/data/clean.torrent')
|
||||||
@ -343,3 +342,18 @@ class TestCleaning(unittest.TestCase):
|
|||||||
self.assertEqual(p.get_meta(), {})
|
self.assertEqual(p.get_meta(), {})
|
||||||
|
|
||||||
os.remove('./tests/data/clean.torrent')
|
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user