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):
32913291 item = AlertGroup )
32923292 return c
32933293
3294- def history (self ):
3294+ def history (self , ** kwargs ):
32953295 """Returns a list of search jobs corresponding to this saved search.
32963296
3297+ :param `kwargs`: Additional arguments (optional).
3298+ :type kwargs: ``dict``
3299+
32973300 :return: A list of :class:`Job` objects.
32983301 """
3299- response = self .get ("history" )
3302+ response = self .get ("history" , ** kwargs )
33003303 entries = _load_atom_entries (response )
33013304 if entries is None : return []
33023305 jobs = []
Original file line number Diff line number Diff line change @@ -170,6 +170,27 @@ def test_history(self):
170170 finally :
171171 job .cancel ()
172172
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+
173194 def test_scheduled_times (self ):
174195 self .saved_search .update (cron_schedule = '*/5 * * * *' , is_scheduled = True )
175196 scheduled_times = self .saved_search .scheduled_times ()
You can’t perform that action at this time.
0 commit comments