Skip to content

Commit da2d4f7

Browse files
committed
fix test_asgi.test_websocket
1 parent 5ccb590 commit da2d4f7

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tests/integrations/asgi/test_asgi.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,23 +355,17 @@ async def test_websocket(sentry_init, asgi3_ws_app, capture_events, request):
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

373365
msg_event, error_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"]

0 commit comments

Comments
 (0)