Skip to content

Commit 38a1374

Browse files
author
David Noble
committed
Test fix
1 parent 8c3517b commit 38a1374

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
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__ fieldname="foo"
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"
1818
supports_multivalues = True
1919
supports_rawargs = True

tests/test_searchcommands_app.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
except ImportError:
2020
import unittest
2121

22+
from json import JSONEncoder
2223
from subprocess import Popen
2324
import os
2425
import shutil
@@ -211,8 +212,6 @@ def setUp(self):
211212
def test_command_parser(self):
212213
from splunklib.searchcommands.search_command_internals import \
213214
SearchCommandParser
214-
from json import JSONEncoder
215-
216215
parser = SearchCommandParser()
217216
encoder = JSONEncoder()
218217
file_path = TestSearchCommandsApp._data_file(os.path.join('input', 'counts.csv'))
@@ -424,8 +423,21 @@ def _assertCorrectConfiguration(self, command, test_name):
424423
output_file_location = os.path.join('output', test_name + '.csv')
425424
with TestSearchCommandsApp._open_data_file(os.path.join('input', '_empty.csv'), 'r') as input_file:
426425
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'))
427428
command.process(
428-
[command.name, '__GETINFO__', 'fieldname="foo"'],
429+
[
430+
command.name,
431+
'__GETINFO__',
432+
'boolean=false',
433+
'duration=00:00:10',
434+
'fieldname=foo',
435+
'file=%s' % encoder.encode(file_path),
436+
'integer=10',
437+
'optionname=foo_bar',
438+
'regularexpression="\\\\w+"',
439+
'set=foo'
440+
],
429441
input_file,
430442
output_file)
431443
actual = str(command.configuration)

0 commit comments

Comments
 (0)