Test: Update test cases for PR 6906 (#6929)

### What problem does this PR solve?

PR #6906

### Type of change

- [x] Update test cases
This commit is contained in:
liu an 2025-04-10 12:28:56 +08:00 committed by GitHub
parent 3bb1e012e6
commit 8fb5edd927
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,8 +44,8 @@ class TestChatAssistantsDelete:
[
(None, 0, "", 0),
({"ids": []}, 0, "", 0),
({"ids": ["invalid_id"]}, 102, "You don't own the chat invalid_id", 5),
({"ids": ["\n!?。;!?\"'"]}, 102, "You don't own the chat \n!?。;!?\"'", 5),
({"ids": ["invalid_id"]}, 102, "Assistant(invalid_id) not found.", 5),
({"ids": ["\n!?。;!?\"'"]}, 102, """Assistant(\n!?。;!?"\') not found.""", 5),
("not json", 100, "AttributeError(\"'str' object has no attribute 'get'\")", 5),
(lambda r: {"ids": r[:1]}, 0, "", 4),
(lambda r: {"ids": r}, 0, "", 0),
@ -57,8 +57,8 @@ class TestChatAssistantsDelete:
payload = payload(chat_assistant_ids)
res = delete_chat_assistants(get_http_api_auth, payload)
assert res["code"] == expected_code
#if res["code"] != 0:
# assert res["message"] == expected_message
if res["code"] != 0:
assert res["message"] == expected_message
res = list_chat_assistants(get_http_api_auth)
assert len(res["data"]) == remaining
@ -90,13 +90,13 @@ class TestChatAssistantsDelete:
res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids})
assert res["code"] == 102
#assert "You don't own the chat" in res["message"]
assert "not found" in res["message"]
def test_duplicate_deletion(self, get_http_api_auth, add_chat_assistants_func):
_, _, chat_assistant_ids = add_chat_assistants_func
res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids + chat_assistant_ids})
assert res["code"] == 0
assert "Duplicate chat ids" in res["data"]["errors"][0]
assert "Duplicate assistant ids" in res["data"]["errors"][0]
assert res["data"]["success_count"] == 5
res = list_chat_assistants(get_http_api_auth)