Skip to content

Commit ae26899

Browse files
author
David Noble
committed
One more test improvement
1 parent d2f043d commit ae26899

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/searchcommands_data/_expected_results/test_reporting_command_configuration.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ retainsevents = False
1414
run_in_preview = True
1515
stderr_dest = log
1616
streaming = False
17-
streaming_preop = stubbedreporting __map__ boolean=false duration=10 fieldname="foo" file="/Users/david-noble/Workspace/Splunk/splunk-sdk-python/tests/searchcommands_data/input/counts.csv" integer=10 optionname="foo_bar" regularexpression="\\w+" set="foo"
17+
streaming_preop = stubbedreporting __map__ boolean=false duration=10 fieldname="foo" file={file} integer=10 optionname="foo_bar" regularexpression="\\w+" set="foo"
1818
supports_multivalues = True
1919
supports_rawargs = True

tests/test_searchcommands_app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,17 @@ def test_streaming_command_on_server(self):
421421
def _assertCorrectConfiguration(self, command, test_name):
422422
expected_file_location = os.path.join('_expected_results', test_name + '.txt')
423423
output_file_location = os.path.join('output', test_name + '.csv')
424+
file_path = JSONEncoder().encode(TestSearchCommandsApp._data_file(os.path.join('input', 'counts.csv')))
424425
with TestSearchCommandsApp._open_data_file(os.path.join('input', '_empty.csv'), 'r') as input_file:
425426
with TestSearchCommandsApp._open_data_file(output_file_location, 'w') as output_file:
426-
encoder = JSONEncoder()
427-
file_path = TestSearchCommandsApp._data_file(os.path.join('input', 'counts.csv'))
428427
command.process(
429428
[
430429
command.name,
431430
'__GETINFO__',
432431
'boolean=false',
433432
'duration=00:00:10',
434433
'fieldname=foo',
435-
'file=%s' % encoder.encode(file_path),
434+
'file=%s' % file_path,
436435
'integer=10',
437436
'optionname=foo_bar',
438437
'regularexpression="\\\\w+"',
@@ -442,7 +441,7 @@ def _assertCorrectConfiguration(self, command, test_name):
442441
output_file)
443442
actual = str(command.configuration)
444443
with TestSearchCommandsApp._open_data_file(expected_file_location, 'r') as input_file:
445-
expected = ''.join(input_file.readlines())
444+
expected = ''.join(input_file.readlines()).replace("{file}", file_path)
446445
self.assertMultiLineEqual(expected, actual)
447446

448447
def _assertCorrectOutputFile(self, name):

0 commit comments

Comments
 (0)