@@ -28,7 +28,7 @@ def test_server():
28
28
server_thread .start ()
29
29
30
30
# Give the server a moment to start
31
- time .sleep (8 )
31
+ time .sleep (2 )
32
32
33
33
import asyncio
34
34
import json
@@ -39,7 +39,7 @@ def test_server():
39
39
async def test_fastapi_server ():
40
40
import asyncio
41
41
42
- async with websockets .connect ("ws://localhost:8000/ws " ) as websocket :
42
+ async with websockets .connect ("ws://localhost:8000/" ) as websocket :
43
43
# Connect to the websocket
44
44
print ("Connected to WebSocket" )
45
45
@@ -105,7 +105,7 @@ async def test_fastapi_server():
105
105
{
106
106
"role" : "user" ,
107
107
"type" : "message" ,
108
- "content" : "The secret word is 'barlony '." ,
108
+ "content" : "The secret word is 'barloney '." ,
109
109
},
110
110
{"role" : "assistant" , "type" : "message" , "content" : "Understood." },
111
111
],
@@ -134,6 +134,7 @@ async def test_fastapi_server():
134
134
print ("WebSocket chunks sent" )
135
135
136
136
# Wait for a specific response
137
+ accumulated_content = ""
137
138
while True :
138
139
message = await websocket .recv ()
139
140
message_data = json .loads (message )
@@ -148,7 +149,7 @@ async def test_fastapi_server():
148
149
print ("Received expected message from server" )
149
150
break
150
151
151
- assert "barlony " in accumulated_content
152
+ assert "barloney " in accumulated_content
152
153
153
154
# Get the current event loop and run the test function
154
155
loop = asyncio .get_event_loop ()
0 commit comments