mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-19 12:39:59 +08:00
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:
parent
3bb1e012e6
commit
8fb5edd927
@ -44,8 +44,8 @@ class TestChatAssistantsDelete:
|
|||||||
[
|
[
|
||||||
(None, 0, "", 0),
|
(None, 0, "", 0),
|
||||||
({"ids": []}, 0, "", 0),
|
({"ids": []}, 0, "", 0),
|
||||||
({"ids": ["invalid_id"]}, 102, "You don't own the chat invalid_id", 5),
|
({"ids": ["invalid_id"]}, 102, "Assistant(invalid_id) not found.", 5),
|
||||||
({"ids": ["\n!?。;!?\"'"]}, 102, "You don't own the chat \n!?。;!?\"'", 5),
|
({"ids": ["\n!?。;!?\"'"]}, 102, """Assistant(\n!?。;!?"\') not found.""", 5),
|
||||||
("not json", 100, "AttributeError(\"'str' object has no attribute 'get'\")", 5),
|
("not json", 100, "AttributeError(\"'str' object has no attribute 'get'\")", 5),
|
||||||
(lambda r: {"ids": r[:1]}, 0, "", 4),
|
(lambda r: {"ids": r[:1]}, 0, "", 4),
|
||||||
(lambda r: {"ids": r}, 0, "", 0),
|
(lambda r: {"ids": r}, 0, "", 0),
|
||||||
@ -57,8 +57,8 @@ class TestChatAssistantsDelete:
|
|||||||
payload = payload(chat_assistant_ids)
|
payload = payload(chat_assistant_ids)
|
||||||
res = delete_chat_assistants(get_http_api_auth, payload)
|
res = delete_chat_assistants(get_http_api_auth, payload)
|
||||||
assert res["code"] == expected_code
|
assert res["code"] == expected_code
|
||||||
#if res["code"] != 0:
|
if res["code"] != 0:
|
||||||
# assert res["message"] == expected_message
|
assert res["message"] == expected_message
|
||||||
|
|
||||||
res = list_chat_assistants(get_http_api_auth)
|
res = list_chat_assistants(get_http_api_auth)
|
||||||
assert len(res["data"]) == remaining
|
assert len(res["data"]) == remaining
|
||||||
@ -90,13 +90,13 @@ class TestChatAssistantsDelete:
|
|||||||
|
|
||||||
res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids})
|
res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids})
|
||||||
assert res["code"] == 102
|
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):
|
def test_duplicate_deletion(self, get_http_api_auth, add_chat_assistants_func):
|
||||||
_, _, chat_assistant_ids = 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})
|
res = delete_chat_assistants(get_http_api_auth, {"ids": chat_assistant_ids + chat_assistant_ids})
|
||||||
assert res["code"] == 0
|
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
|
assert res["data"]["success_count"] == 5
|
||||||
|
|
||||||
res = list_chat_assistants(get_http_api_auth)
|
res = list_chat_assistants(get_http_api_auth)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user