From 0fa184cb6fbe05ebbec9054b493e80b9a5e91683 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 23 Apr 2018 00:24:39 +0200 Subject: Test .odf support --- tests/data/dirty.odf | Bin 0 -> 4861 bytes tests/test_libmat2.py | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/data/dirty.odf (limited to 'tests') diff --git a/tests/data/dirty.odf b/tests/data/dirty.odf new file mode 100644 index 0000000..49da2bc Binary files /dev/null and b/tests/data/dirty.odf differ diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index ff5c196..6efaf31 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py @@ -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') -- cgit v1.3