@@ -349,35 +349,32 @@ async def test_trace_from_headers_if_performance_disabled(
349349
350350@pytest .mark .asyncio
351351async def test_websocket (sentry_init , asgi3_ws_app , capture_events , request ):
352- sentry_init (send_default_pii = True )
352+ sentry_init (send_default_pii = True , traces_sample_rate = 1.0 )
353353
354354 events = capture_events ()
355355
356356 asgi3_ws_app = SentryAsgiMiddleware (asgi3_ws_app )
357357
358- scope = {
359- "type" : "websocket" ,
360- "endpoint" : asgi3_app ,
361- "client" : ("127.0.0.1" , 60457 ),
362- "route" : "some_url" ,
363- "headers" : [
364- ("accept" , "*/*" ),
365- ],
366- }
358+ request_url = "/ws"
367359
368360 with pytest .raises (ValueError ):
369- async with TestClient (asgi3_ws_app , scope = scope ) as client :
370- async with client .websocket_connect ("/ws" ) as ws :
371- await ws .receive_text ()
361+ client = TestClient (asgi3_ws_app )
362+ async with client .websocket_connect (request_url ) as ws :
363+ await ws .receive_text ()
372364
373- msg_event , error_event = events
365+ msg_event , error_event , transaction_event = events
374366
367+ assert msg_event ["transaction" ] == request_url
368+ assert msg_event ["transaction_info" ] == {"source" : "url" }
375369 assert msg_event ["message" ] == "Some message to the world!"
376370
377371 (exc ,) = error_event ["exception" ]["values" ]
378372 assert exc ["type" ] == "ValueError"
379373 assert exc ["value" ] == "Oh no"
380374
375+ assert transaction_event ["transaction" ] == request_url
376+ assert transaction_event ["transaction_info" ] == {"source" : "url" }
377+
381378
382379@pytest .mark .asyncio
383380async def test_auto_session_tracking_with_aggregates (
0 commit comments