@@ -186,7 +186,7 @@ async def fake_chat(post_data: dict | None = None):
186186 "/api/v1/chat" ,
187187 json = {
188188 "message" : "hello" ,
189- "username" : "alice " ,
189+ "username" : "alice_auto_session " ,
190190 "enable_streaming" : False ,
191191 },
192192 headers = {"X-API-Key" : raw_key },
@@ -200,16 +200,16 @@ async def fake_chat(post_data: dict | None = None):
200200 created_session_id = send_data ["data" ]["session_id" ]
201201 assert isinstance (created_session_id , str )
202202 uuid .UUID (created_session_id )
203- assert send_data ["data" ]["creator" ] == "alice "
203+ assert send_data ["data" ]["creator" ] == "alice_auto_session "
204204 created_session = await core_lifecycle_td .db .get_platform_session_by_id (
205205 created_session_id
206206 )
207207 assert created_session is not None
208- assert created_session .creator == "alice "
208+ assert created_session .creator == "alice_auto_session "
209209 assert created_session .platform_id == "webchat"
210210
211211 await core_lifecycle_td .db .create_platform_session (
212- creator = "bob " ,
212+ creator = "bob_auto_session " ,
213213 platform_id = "webchat" ,
214214 session_id = "open_api_existing_bob_session" ,
215215 is_group = 0 ,
@@ -251,14 +251,15 @@ async def test_open_chat_sessions_pagination(
251251
252252 create_res = await test_client .post (
253253 "/api/apikey/create" ,
254- json = {"name" : "chat-scope-key" , "scopes" : ["chat" ]},
254+ json = {"name" : "chat-scope-key-pagination " , "scopes" : ["chat" ]},
255255 headers = authenticated_header ,
256256 )
257257 create_data = await create_res .get_json ()
258258 assert create_data ["status" ] == "ok"
259259 raw_key = create_data ["data" ]["api_key" ]
260260
261- creator = "alice"
261+ # Use unique session IDs to avoid conflicts with other tests
262+ creator = "alice_pagination"
262263 for idx in range (3 ):
263264 await core_lifecycle_td .db .create_platform_session (
264265 creator = creator ,
@@ -268,15 +269,15 @@ async def test_open_chat_sessions_pagination(
268269 is_group = 0 ,
269270 )
270271 await core_lifecycle_td .db .create_platform_session (
271- creator = "bob " ,
272+ creator = "bob_pagination " ,
272273 platform_id = "webchat" ,
273274 session_id = "open_api_paginated_bob" ,
274275 display_name = "Open API Session Bob" ,
275276 is_group = 0 ,
276277 )
277278
278279 page_1_res = await test_client .get (
279- "/api/v1/chat/sessions?page=1&page_size=2&username=alice " ,
280+ "/api/v1/chat/sessions?page=1&page_size=2&username=alice_pagination " ,
280281 headers = {"X-API-Key" : raw_key },
281282 )
282283 assert page_1_res .status_code == 200
@@ -286,10 +287,10 @@ async def test_open_chat_sessions_pagination(
286287 assert page_1_data ["data" ]["page_size" ] == 2
287288 assert page_1_data ["data" ]["total" ] == 3
288289 assert len (page_1_data ["data" ]["sessions" ]) == 2
289- assert all (item ["creator" ] == "alice " for item in page_1_data ["data" ]["sessions" ])
290+ assert all (item ["creator" ] == "alice_pagination " for item in page_1_data ["data" ]["sessions" ])
290291
291292 page_2_res = await test_client .get (
292- "/api/v1/chat/sessions?page=2&page_size=2&username=alice " ,
293+ "/api/v1/chat/sessions?page=2&page_size=2&username=alice_pagination " ,
293294 headers = {"X-API-Key" : raw_key },
294295 )
295296 assert page_2_res .status_code == 200
0 commit comments