diff --git a/tests/ppt_parser/__init__.py b/tests/ppt_parser/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/ppt_parser/__init__.py diff --git a/tests/ppt_parser/test_basic.py b/tests/ppt_parser/test_basic.py new file mode 100644 index 0000000..8956b30 --- /dev/null +++ b/tests/ppt_parser/test_basic.py @@ -0,0 +1,37 @@ +""" Test ppt_parser and ppt_record_parser """ + +import unittest +import os +from os.path import join + +# Directory with test data, independent of current working directory +from tests.test_utils import DATA_BASE_DIR + +from oletools import ppt_record_parser +# ppt_parser not tested yet + + +class TestBasic(unittest.TestCase): + """ test basic functionality of ppt parsing """ + + def test_is_ppt(self): + """ test ppt_record_parser.is_ppt(filename) """ + exceptions = [] + for base_dir, _, files in os.walk(DATA_BASE_DIR): + for filename in files: + if filename in exceptions: + continue + full_name = join(base_dir, filename) + if filename.endswith('.ppt') or filename.endswith('.pps'): + self.assertTrue(ppt_record_parser.is_ppt(full_name), + msg='{0} not recognized as ppt file' + .format(full_name)) + else: + self.assertFalse(ppt_record_parser.is_ppt(full_name), + msg='{0} erroneously recognized as ppt' + .format(full_name)) + + +# just in case somebody calls this file as a script +if __name__ == '__main__': + unittest.main()