@@ -49,6 +49,8 @@ def __init__(self, server_address, app):
4949 self .project_config_simulate_pending = False
5050 self .project_config_ignore_revision = False
5151
52+ self .timeout = 5
53+
5254 @property
5355 def internal_error_dsn (self ):
5456 """DSN whose events make the test fail."""
@@ -201,7 +203,7 @@ def set_global_config_option(self, option_name, value):
201203 self .global_config ["options" ][option_name ] = value
202204
203205 def get_client_report (self , timeout = None ):
204- envelope = self .captured_events .get (timeout = timeout )
206+ envelope = self .captured_events .get (timeout = timeout or self . timeout )
205207 items = envelope .items
206208 assert len (items ) == 1
207209 item = items [0 ]
@@ -210,7 +212,7 @@ def get_client_report(self, timeout=None):
210212 return json .loads (item .payload .bytes )
211213
212214 def get_metrics (self , timeout = None ):
213- envelope = self .captured_events .get (timeout = timeout )
215+ envelope = self .captured_events .get (timeout = timeout or self . timeout )
214216 items = envelope .items
215217 assert len (items ) == 1
216218 item = items [0 ]
@@ -225,6 +227,17 @@ def get_metrics(self, timeout=None):
225227 ),
226228 )
227229
230+ def get_outcomes (self , n , * , timeout = None ):
231+ outcomes = []
232+ for _ in range (n ):
233+ outcomes .extend (
234+ self .captured_outcomes .get (timeout = timeout or self .timeout ).get (
235+ "outcomes"
236+ )
237+ )
238+ outcomes .sort (key = lambda x : x ["category" ])
239+ return outcomes
240+
228241
229242def _get_project_id (public_key , project_configs ):
230243 for project_id , project_config in project_configs .items ():
0 commit comments