From 1bb50a33a716418506e6f5953e9829e86cfe0bf5 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 27 Oct 2017 16:15:36 +0200 Subject: [PATCH] unittest: finish olevba-json validity tests --- tests/json/test_output.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/json/test_output.py b/tests/json/test_output.py index 92d0e55..823e4b8 100644 --- a/tests/json/test_output.py +++ b/tests/json/test_output.py @@ -56,6 +56,7 @@ class TestValidJson(unittest.TestCase): except ValueError: self.fail('Invalid json:\n' + capturer.buffer.getvalue()) self.assertNotEqual(len(json_data), 0, msg='Output was empty') + return json_data def run_all_files(self, program, args_without_filename, print_output=False): """ run test for a single program over all test files """ @@ -71,20 +72,20 @@ class TestValidJson(unittest.TestCase): """ Test msodde.py """ self.run_all_files(msodde.main, ['-j', ]) - @unittest.skip('olevba needs patching to accept custom cmd line args') def test_olevba(self): """ Test olevba.py with default args """ self.run_all_files(olevba.main, ['-j', ]) - @unittest.skip('olevba needs patching to accept custom cmd line args') def test_olevba_analysis(self): - """ Test olevba.py with default args """ + """ Test olevba.py with -a """ self.run_all_files(olevba.main, ['-j', '-a', ]) - @unittest.skip('olevba needs patching to accept custom cmd line args') def test_olevba_recurse(self): - """ Test olevba.py with default args """ - self.run_and_parse(olevba.main, ['-j', '-r', DATA_DIR], True) + """ Test olevba.py with -r """ + json_data = self.run_and_parse(olevba.main, + ['-j', '-r', join(DATA_BASE_DIR, '*')]) + self.assertNotEqual(json_data[-1]['n_processed'], 0, + msg='self-test fail: No test files found!') # just in case somebody calls this file as a script -- libgit2 0.21.4