Add test for API (#3134)
### What problem does this PR solve? Add test for API ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn> Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import os
|
||||
from ragflow_sdk import RAGFlow
|
||||
|
||||
HOST_ADDRESS = os.getenv('HOST_ADDRESS', 'http://127.0.0.1:9380')
|
||||
from common import HOST_ADDRESS
|
||||
|
||||
def test_create_chat_with_name(get_api_key_fixture):
|
||||
API_KEY = get_api_key_fixture
|
||||
@@ -16,7 +14,7 @@ def test_create_chat_with_name(get_api_key_fixture):
|
||||
docs= kb.upload_documents(documents)
|
||||
for doc in docs:
|
||||
doc.add_chunk("This is a test to add chunk")
|
||||
rag.create_chat("test_create", dataset_ids=[kb.id])
|
||||
rag.create_chat("test_create_chat", dataset_ids=[kb.id])
|
||||
|
||||
|
||||
def test_update_chat_with_name(get_api_key_fixture):
|
||||
@@ -32,7 +30,7 @@ def test_update_chat_with_name(get_api_key_fixture):
|
||||
docs = kb.upload_documents(documents)
|
||||
for doc in docs:
|
||||
doc.add_chunk("This is a test to add chunk")
|
||||
chat = rag.create_chat("test_update", dataset_ids=[kb.id])
|
||||
chat = rag.create_chat("test_update_chat", dataset_ids=[kb.id])
|
||||
chat.update({"name": "new_chat"})
|
||||
|
||||
|
||||
@@ -49,7 +47,7 @@ def test_delete_chats_with_success(get_api_key_fixture):
|
||||
docs = kb.upload_documents(documents)
|
||||
for doc in docs:
|
||||
doc.add_chunk("This is a test to add chunk")
|
||||
chat = rag.create_chat("test_delete", dataset_ids=[kb.id])
|
||||
chat = rag.create_chat("test_delete_chat", dataset_ids=[kb.id])
|
||||
rag.delete_chats(ids=[chat.id])
|
||||
|
||||
def test_list_chats_with_success(get_api_key_fixture):
|
||||
|
||||
Reference in New Issue
Block a user