|
6 | 6 | from unittest.mock import patch
|
7 | 7 | from utils import process_and_return_exclusions, is_json, add_lines, rgignore_cleanup
|
8 | 8 | from utils import get_batch_info, truncate_line, get_source_type, open_csv, get_colors
|
9 |
| -from utils import write_file, grab_repo_name, get_hannibal_hec_info, TimeFunction, BiasedLanguageLogger |
| 9 | +from utils import write_file, grab_repo_name, get_hec_info, TimeFunction, BiasedLanguageLogger |
10 | 10 | from utils import get_line_count
|
11 | 11 | from run_json import main, rg_search, build_args_dict, process_word_occurrences, process_biased_word_line
|
12 | 12 | from tools.event2splunk import Event2Splunk
|
@@ -115,7 +115,7 @@ def test_build_args_dict():
|
115 | 115 | assert args['path'] == mock_repo_path
|
116 | 116 | assert args['mode'] == 'check'
|
117 | 117 | assert args['err_file'] == constants.ERR_FILE
|
118 |
| - assert len(args) == 10 |
| 118 | + assert len(args) == 12 |
119 | 119 |
|
120 | 120 |
|
121 | 121 | def test_process_word_occurrences(batch_info):
|
@@ -183,14 +183,14 @@ def test_exclusions_if_no_exclude_file():
|
183 | 183 |
|
184 | 184 | def test_get_splunk_hec_info():
|
185 | 185 | with pytest.raises(Exception) as no_hec:
|
186 |
| - get_hannibal_hec_info(None) |
187 |
| - assert "No Splunk HEC token provided" in str(no_hec.value) |
| 186 | + get_hec_info(None, None) |
| 187 | + assert "Missing Splunk HEC token" in str(no_hec.value) |
188 | 188 |
|
189 | 189 |
|
190 | 190 | def test_event2splunk(mocker):
|
191 | 191 | logger = BiasedLanguageLogger(
|
192 | 192 | name='UnitTesting', filename='UnitTesting.log')
|
193 |
| - hec = get_hannibal_hec_info('valid-token') |
| 193 | + hec = get_hec_info('valid-token', 'https://fakeurl.com:1234') |
194 | 194 | event2splunk = Event2Splunk(hec, logger)
|
195 | 195 | mocker.patch('tools.event2splunk.Event2Splunk._send_batch')
|
196 | 196 | event2splunk.post_event(payload={}, source='testing', sourcetype='testing')
|
@@ -237,7 +237,9 @@ def test_main(mock_post_event, mock_close_event):
|
237 | 237 | 'splunk_flag': True,
|
238 | 238 | 'enable_logs': False,
|
239 | 239 | 'err_file': constants.ERR_FILE,
|
| 240 | + 'h_endpoint': 'valid-endpoint:1234', |
240 | 241 | 'splunk_token': 'valid-token',
|
| 242 | + 'pz_endpoint': 'valid-endpoint:1234', |
241 | 243 | 'pzero_token': 'valid-token',
|
242 | 244 | 'github_repo': None
|
243 | 245 | }
|
|
0 commit comments