@@ -1660,16 +1660,17 @@ async def test_no_metric_for_websockets(self):
16601660 await self .get_all_output ()
16611661 self .assertIsNone (self .memory_metrics_reader .get_metrics_data ())
16621662
1663- def test_put_request_with_user_id (self ):
1664- app = otel_asgi .OpenTelemetryMiddleware (user_update_app )
1665- self .seed_app (app )
1663+ async def test_put_request_with_user_id (self ):
16661664 self .scope ["method" ] = "PUT"
16671665 self .scope ["path" ] = "/api/v3/io/users/123"
1668- self .send_input (
1666+
1667+ app = otel_asgi .OpenTelemetryMiddleware (user_update_app )
1668+ self .seed_app (app )
1669+ await self .send_input (
16691670 {"type" : "http.request" , "body" : b'{"name": "John Doe"}' }
16701671 )
16711672
1672- outputs = self .get_all_output ()
1673+ outputs = await self .get_all_output ()
16731674 self .assertEqual (len (outputs ), 2 )
16741675 self .assertEqual (outputs [0 ]["type" ], "http.response.start" )
16751676 self .assertEqual (outputs [0 ]["status" ], 200 )
@@ -1690,17 +1691,17 @@ def test_put_request_with_user_id(self):
16901691 server_span .attributes [SpanAttributes .HTTP_STATUS_CODE ], 200
16911692 )
16921693
1693- def skip_test_websocket_connection_with_session_id (self ):
1694+ async def skip_test_websocket_connection_with_session_id (self ):
16941695 app = otel_asgi .OpenTelemetryMiddleware (websocket_session_app )
16951696 self .seed_app (app )
16961697 self .scope ["type" ] = "websocket"
16971698 self .scope ["path" ] = "/ws/05b55f3f66aa31cbe6a25e7027f7c2cc"
16981699
1699- self .send_input ({"type" : "websocket.connect" })
1700- self .send_input ({"type" : "websocket.receive" , "text" : "ping" })
1701- self .send_input ({"type" : "websocket.disconnect" })
1700+ await self .send_input ({"type" : "websocket.connect" })
1701+ await self .send_input ({"type" : "websocket.receive" , "text" : "ping" })
1702+ await self .send_input ({"type" : "websocket.disconnect" })
17021703
1703- outputs = self .get_all_output ()
1704+ outputs = await self .get_all_output ()
17041705 self .assertEqual (len (outputs ), 2 )
17051706 self .assertEqual (outputs [0 ]["type" ], "websocket.accept" )
17061707 self .assertEqual (outputs [1 ]["type" ], "websocket.send" )
0 commit comments