Skip to content

Commit 6550577

Browse files
author
Shakeel Mohamed
committed
Add tests for SearchCommandParser.unquote
1 parent 78b3dd5 commit 6550577

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

splunklib/searchcommands/logging.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def configure(name, probing_path=None, app_root=None):
7575
.. _ConfigParser format: http://goo.gl/K6edZ8
7676
7777
"""
78-
if app_root:
79-
print "app_root is " + app_root
78+
8079
app_directory = get_app_directory(sys.argv[0]) if app_root is None else app_root
8180

8281
if probing_path is None:

tests/searchcommands/test_search_command_internals.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,41 @@ def test_command_parser(self):
217217
self.assertListEqual(fields, command.fieldnames)
218218
return
219219

220+
def test_command_parser_unquote(self):
221+
parser = search_command_internals.SearchCommandParser()
222+
223+
options = [
224+
'foo',
225+
'\"foobar\"',
226+
'"""foobar1"""',
227+
'"\"foobar2\""',
228+
'"foo ""x"" bar"',
229+
'"foo \"x\" bar"',
230+
'"\\\\foobar"',
231+
'"foo \\\\ bar"',
232+
'"foobar\\\\"',
233+
'foo\\\\\\bar'
234+
]
235+
236+
expected = [
237+
'foo',
238+
'foobar',
239+
'"foobar1"',
240+
'"foobar2"',
241+
'foo "x" bar',
242+
'foo "x" bar',
243+
'\\foobar',
244+
'foo \\ bar',
245+
'foobar\\',
246+
'foo\\bar'
247+
]
248+
249+
for i in range(0, len(options)):
250+
print parser.unquote(options[i]), " ", options[i]
251+
print expected[i]
252+
self.assertEqual(expected[i], parser.unquote(options[i]))
253+
254+
220255
def test_input_header(self):
221256

222257
# No items

0 commit comments

Comments
 (0)