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 @@ -3212,12 +3212,15 @@ def fired_alerts(self):
32123212 item = AlertGroup )
32133213 return c
32143214
3215- def history (self ):
3215+ def history (self , ** kwargs ):
32163216 """Returns a list of search jobs corresponding to this saved search.
32173217
3218+ :param `kwargs`: Additional arguments (optional).
3219+ :type kwargs: ``dict``
3220+
32183221 :return: A list of :class:`Job` objects.
32193222 """
3220- response = self .get ("history" )
3223+ response = self .get ("history" , ** kwargs )
32213224 entries = _load_atom_entries (response )
32223225 if entries is None : return []
32233226 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