Commit 4cbf6aa985171dfc29bf9040020065e4dfaac27f
Committed by
GitHub
Merge pull request #769 from christian-intra2net/fix-unittests
Fix unittests
Showing
2 changed files
with
2 additions
and
5 deletions
oletools/olevba.py
| @@ -3112,7 +3112,7 @@ class VBA_Parser(object): | @@ -3112,7 +3112,7 @@ class VBA_Parser(object): | ||
| 3112 | xlm_macro_found = False | 3112 | xlm_macro_found = False |
| 3113 | xlm_macros = [] | 3113 | xlm_macros = [] |
| 3114 | xlm_macros.append('Formulas and XLM/Excel 4 macros extracted from SLK file:') | 3114 | xlm_macros.append('Formulas and XLM/Excel 4 macros extracted from SLK file:') |
| 3115 | - for line in data.splitlines(keepends=False): | 3115 | + for line in data.splitlines(False): |
| 3116 | if line.startswith(b'O'): | 3116 | if line.startswith(b'O'): |
| 3117 | # Option: "O;E" indicates a macro sheet, must appear before NN and C rows | 3117 | # Option: "O;E" indicates a macro sheet, must appear before NN and C rows |
| 3118 | for s in line.split(b';'): | 3118 | for s in line.split(b';'): |
tests/olevba/test_basic.py
| @@ -120,12 +120,9 @@ class TestOlevbaBasic(unittest.TestCase): | @@ -120,12 +120,9 @@ class TestOlevbaBasic(unittest.TestCase): | ||
| 120 | args=[full_name, ] + ADD_ARGS, | 120 | args=[full_name, ] + ADD_ARGS, |
| 121 | accept_nonzero_exit=True) | 121 | accept_nonzero_exit=True) |
| 122 | output = json.loads(out_str) | 122 | output = json.loads(out_str) |
| 123 | - self.assertEqual(len(output), 3) | 123 | + self.assertEqual(len(output), 2) |
| 124 | self.assertEqual(output[0]['type'], 'MetaInformation') | 124 | self.assertEqual(output[0]['type'], 'MetaInformation') |
| 125 | self.assertEqual(output[0]['script_name'], 'olevba') | 125 | self.assertEqual(output[0]['script_name'], 'olevba') |
| 126 | - self.assertEqual(output[-1]['type'], 'MetaInformation') | ||
| 127 | - self.assertEqual(output[-1]['n_processed'], 1) | ||
| 128 | - self.assertEqual(output[-1]['return_code'], 0) | ||
| 129 | result = output[1] | 126 | result = output[1] |
| 130 | self.assertTrue(result['json_conversion_successful']) | 127 | self.assertTrue(result['json_conversion_successful']) |
| 131 | if suffix in ('.xlsb', '.xltm', '.xlsm'): | 128 | if suffix in ('.xlsb', '.xltm', '.xlsm'): |