diff options
| author | jvoisin | 2019-07-13 21:26:05 +0200 |
|---|---|---|
| committer | jvoisin | 2019-07-13 21:26:05 +0200 |
| commit | 4999209f9ce01c824020f5b68403c5b4b52d3e8c (patch) | |
| tree | 82f9dbb319be771d26f6f04ed8f76f9b1875fa04 /tests/test_libmat2.py | |
| parent | bdd55810330701e13dd9a0a5f6bb34652fe601eb (diff) | |
Add support for svg
Diffstat (limited to 'tests/test_libmat2.py')
| -rw-r--r-- | tests/test_libmat2.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py index 64e679f..796d2f1 100644 --- a/tests/test_libmat2.py +++ b/tests/test_libmat2.py | |||
| @@ -73,13 +73,13 @@ class TestParameterInjection(unittest.TestCase): | |||
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | class TestUnsupportedEmbeddedFiles(unittest.TestCase): | 75 | class TestUnsupportedEmbeddedFiles(unittest.TestCase): |
| 76 | def test_odt_with_svg(self): | 76 | def test_odt_with_py(self): |
| 77 | shutil.copy('./tests/data/embedded.odt', './tests/data/clean.odt') | 77 | shutil.copy('./tests/data/embedded.odt', './tests/data/clean.odt') |
| 78 | p = office.LibreOfficeParser('./tests/data/clean.odt') | 78 | p = office.LibreOfficeParser('./tests/data/clean.odt') |
| 79 | self.assertFalse(p.remove_all()) | 79 | self.assertFalse(p.remove_all()) |
| 80 | os.remove('./tests/data/clean.odt') | 80 | os.remove('./tests/data/clean.odt') |
| 81 | 81 | ||
| 82 | def test_docx_with_svg(self): | 82 | def test_docx_with_py(self): |
| 83 | shutil.copy('./tests/data/embedded.docx', './tests/data/clean.docx') | 83 | shutil.copy('./tests/data/embedded.docx', './tests/data/clean.docx') |
| 84 | p = office.MSOfficeParser('./tests/data/clean.docx') | 84 | p = office.MSOfficeParser('./tests/data/clean.docx') |
| 85 | self.assertFalse(p.remove_all()) | 85 | self.assertFalse(p.remove_all()) |
| @@ -862,3 +862,27 @@ class TestCleaning(unittest.TestCase): | |||
| 862 | os.remove('./tests/data/dirty.tar.xz') | 862 | os.remove('./tests/data/dirty.tar.xz') |
| 863 | os.remove('./tests/data/dirty.cleaned.tar.xz') | 863 | os.remove('./tests/data/dirty.cleaned.tar.xz') |
| 864 | os.remove('./tests/data/dirty.cleaned.cleaned.tar.xz') | 864 | os.remove('./tests/data/dirty.cleaned.cleaned.tar.xz') |
| 865 | |||
| 866 | def test_svg(self): | ||
| 867 | shutil.copy('./tests/data/dirty.svg', './tests/data/clean.svg') | ||
| 868 | p = images.SVGParser('./tests/data/clean.svg') | ||
| 869 | |||
| 870 | meta = p.get_meta() | ||
| 871 | self.assertEqual(meta['WorkCreatorAgentTitle'], 'GNOME Design Team') | ||
| 872 | self.assertEqual(meta['WorkSubject'], ['mat2', 'logo', 'metadata']) | ||
| 873 | self.assertEqual(meta['ID'], 'svg11300') | ||
| 874 | self.assertEqual(meta['Output_extension'], | ||
| 875 | 'org.inkscape.output.svg.inkscape') | ||
| 876 | |||
| 877 | ret = p.remove_all() | ||
| 878 | self.assertTrue(ret) | ||
| 879 | |||
| 880 | p = images.SVGParser('./tests/data/clean.cleaned.svg') | ||
| 881 | self.assertEqual(p.get_meta(), {}) | ||
| 882 | self.assertTrue(p.remove_all()) | ||
| 883 | |||
| 884 | os.remove('./tests/data/clean.svg') | ||
| 885 | os.remove('./tests/data/clean.cleaned.svg') | ||
| 886 | os.remove('./tests/data/clean.cleaned.cleaned.svg') | ||
| 887 | |||
| 888 | |||
