Commit 661cd5eb8c6f4fd5476b024be3ee03a6e8471dfd

Authored by Samir Aguiar
Committed by Philippe Lagadec
1 parent 9f71892c

Initial support for unit tests (#201)

.travis.yml 0 → 100644
  1 +language: python
  2 +
  3 +python:
  4 + - "2.7"
  5 +cache: pip
  6 +script:
  7 + - python setup.py test
README.md
1 python-oletools 1 python-oletools
2 =============== 2 ===============
3 [![PyPI](https://img.shields.io/pypi/v/oletools.svg)](https://pypi.python.org/pypi/oletools) 3 [![PyPI](https://img.shields.io/pypi/v/oletools.svg)](https://pypi.python.org/pypi/oletools)
  4 +![Build](https://travis-ci.org/samiraguiar/oletools.svg?branch=add-unit-tests)
4 5
5 [oletools](http://www.decalage.info/python/oletools) is a package of python tools to analyze 6 [oletools](http://www.decalage.info/python/oletools) is a package of python tools to analyze
6 [Microsoft OLE2 files](http://en.wikipedia.org/wiki/Compound_File_Binary_Format) 7 [Microsoft OLE2 files](http://en.wikipedia.org/wiki/Compound_File_Binary_Format)
setup.py
@@ -314,6 +314,7 @@ def main(): @@ -314,6 +314,7 @@ def main():
314 download_url=download_url, 314 download_url=download_url,
315 # data_files=data_files, 315 # data_files=data_files,
316 entry_points=entry_points, 316 entry_points=entry_points,
  317 + test_suite="tests",
317 # scripts=scripts, 318 # scripts=scripts,
318 ) 319 )
319 320
tests/__init__.py 0 → 100644
tests/rtfobj/__init__.py 0 → 100644
tests/rtfobj/test_issue_185.py 0 → 100644
  1 +import unittest, sys, os
  2 +
  3 +from .. import testdata_reader
  4 +from oletools import rtfobj
  5 +
  6 +class TestRtfObjIssue185(unittest.TestCase):
  7 + def test_skip_space_after_bin_control_word(self):
  8 + data = testdata_reader.read('rtfobj/issue_185.rtf')
  9 + rtfp = rtfobj.RtfObjParser(data)
  10 + rtfp.parse()
  11 + objects = rtfp.objects
  12 +
  13 + self.assertTrue(len(objects) == 1)
  14 +
  15 +if __name__ == '__main__':
  16 + unittest.main()
tests/test-data/rtfobj/issue_185.rtf 0 → 100644
  1 +{\rt{\object\objautlink\objupdate\rsltpict\objw37542\objh829\objscalex59286\objscaley86308{\*\objclass \'77}{\*\objdata 32\bin6 FF}}}
0 \ No newline at end of file 2 \ No newline at end of file
tests/testdata_reader.py 0 → 100644
  1 +import os
  2 +
  3 +def read(relative_path):
  4 + test_data = os.path.dirname(os.path.abspath(__file__)) + '/test-data/'
  5 + return open(test_data + relative_path, 'rb').read()
  6 +