File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -3291,12 +3291,15 @@ def fired_alerts(self):
3291
3291
item = AlertGroup )
3292
3292
return c
3293
3293
3294
- def history (self ):
3294
+ def history (self , ** kwargs ):
3295
3295
"""Returns a list of search jobs corresponding to this saved search.
3296
3296
3297
+ :param `kwargs`: Additional arguments (optional).
3298
+ :type kwargs: ``dict``
3299
+
3297
3300
:return: A list of :class:`Job` objects.
3298
3301
"""
3299
- response = self .get ("history" )
3302
+ response = self .get ("history" , ** kwargs )
3300
3303
entries = _load_atom_entries (response )
3301
3304
if entries is None : return []
3302
3305
jobs = []
Original file line number Diff line number Diff line change @@ -170,6 +170,27 @@ def test_history(self):
170
170
finally :
171
171
job .cancel ()
172
172
173
+ def test_history_with_options (self ):
174
+ try :
175
+ old_jobs = self .saved_search .history ()
176
+ old_jobs_cnt = len (old_jobs )
177
+
178
+ curr_job_cnt = 50
179
+ for _ in range (curr_job_cnt ):
180
+ job = self .saved_search .dispatch ()
181
+ while not job .is_ready ():
182
+ sleep (0.1 )
183
+
184
+ # fetching all the jobs
185
+ history = self .saved_search .history (count = 0 )
186
+ self .assertEqual (len (history ), old_jobs_cnt + curr_job_cnt )
187
+
188
+ # fetching 3 jobs
189
+ history = self .saved_search .history (count = 3 )
190
+ self .assertEqual (len (history ), 3 )
191
+ finally :
192
+ job .cancel ()
193
+
173
194
def test_scheduled_times (self ):
174
195
self .saved_search .update (cron_schedule = '*/5 * * * *' , is_scheduled = True )
175
196
scheduled_times = self .saved_search .scheduled_times ()
You can’t perform that action at this time.
0 commit comments