Test: Refactor test fixtures and add SDK session management tests (#8141)

### What problem does this PR solve?

- Consolidate HTTP API test fixtures using batch operations
(batch_add_chunks, batch_create_chat_assistants)
- Fix fixture initialization order in clear_session_with_chat_assistants
- Add new SDK API test suite for session management
(create/delete/list/update)

### Type of change

- [x] Add test cases
- [x] Refactoring
This commit is contained in:
Liu An
2025-06-09 18:13:26 +08:00
committed by GitHub
parent 9a69d5f367
commit 5cc2eda362
18 changed files with 649 additions and 138 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License.
#
import pytest
from common import create_chat_assistant, delete_chat_assistants, list_documents, parse_documents
from common import batch_create_chat_assistants, delete_chat_assistants, list_documents, parse_documents
from utils import wait_for
@ -37,10 +37,4 @@ def add_chat_assistants_func(request, api_key, add_document):
dataset_id, document_id = add_document
parse_documents(api_key, dataset_id, {"document_ids": [document_id]})
condition(api_key, dataset_id)
chat_assistant_ids = []
for i in range(5):
res = create_chat_assistant(api_key, {"name": f"test_chat_assistant_{i}", "dataset_ids": [dataset_id]})
chat_assistant_ids.append(res["data"]["id"])
return dataset_id, document_id, chat_assistant_ids
return dataset_id, document_id, batch_create_chat_assistants(api_key, 5)