Skip to content

Commit e6fa192

Browse files
author
Shakeel Mohamed
committed
Make saved searches with names work in saved_search/saved_search.py
Also added some tests, and fixed a readme typo.
1 parent ecc3a5d commit e6fa192

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

examples/saved_search/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ saved search actions.
88
`list` and `delete` requires the `--name` argument to either list the contents
99
of a specific saved search or delete a specific saved search.
1010

11-
`create` requires the `--name` argument, as well as a littany of other arguments
11+
`create` requires the `--name` argument, as well as a list of any other arguments
1212
to establish a saved search. The help output is seen below.
1313

1414
Of special note is the events that can perform actions (`--actions` and

examples/saved_search/saved_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ def main(argv):
174174
if key == "operation":
175175
operation = opts.kwargs[key]
176176
else:
177-
kwargs[key] = urllib.quote(opts.kwargs[key])
177+
kwargs[key] = opts.kwargs[key]
178178

179179
# no operation? if name present, default to list, otherwise list-all
180180
if not operation:
181181
if kwargs.has_key('name'):
182182
operation = 'list'
183183
else:
184184
operation = 'list-all'
185-
185+
186186
# pre-sanitize
187187
if (operation != "list" and operation != "create"
188188
and operation != "delete"

tests/test_examples.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,19 @@ def test_saved_searches(self):
195195
self.check_commands(
196196
"saved_searches.py --help",
197197
"saved_searches.py")
198-
198+
199+
def test_saved_search(self):
200+
temp_name = testlib.tmpname()
201+
self.check_commands(
202+
"saved_search/saved_search.py",
203+
["saved_search/saved_search.py", "--help"],
204+
["saved_search/saved_search.py", "list-all"],
205+
["saved_search/saved_search.py", "--operation", "create", "--name", temp_name, "--search", "search * | head 5"],
206+
["saved_search/saved_search.py", "list", "--name", temp_name],
207+
["saved_search/saved_search.py", "list", "--operation", "delete", "--name", temp_name],
208+
["saved_search/saved_search.py", "list", "--name", "Top five sourcetypes"]
209+
)
210+
199211
def test_search(self):
200212
self.check_commands(
201213
"search.py --help",

0 commit comments

Comments
 (0)