It's Riseup's twentieth year, help keep us going! If you can afford it, please contribute to our winter fundraising drive.

Commit 0fa184cb authored by jvoisin's avatar jvoisin

Test .odf support

parent 73db1603
......@@ -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):
......
......@@ -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')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment