mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 06:46:40 +08:00
Change knowledge base to dataset (#11976)
### What problem does this PR solve? As title ### Type of change - [x] Refactoring --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@ -21,7 +21,7 @@ from common import create_dialog, delete_dialog, get_dialog, update_dialog
|
||||
class TestDialogEdgeCases:
|
||||
@pytest.mark.p2
|
||||
def test_create_dialog_with_tavily_api_key(self, WebApiAuth):
|
||||
"""Test creating dialog with Tavily API key instead of knowledge base"""
|
||||
"""Test creating dialog with Tavily API key instead of dataset"""
|
||||
payload = {
|
||||
"name": "tavily_dialog",
|
||||
"prompt_config": {"system": "You are a helpful assistant. Use this knowledge: {knowledge}", "parameters": [{"key": "knowledge", "optional": True}], "tavily_api_key": "test_tavily_key"},
|
||||
|
||||
@ -60,7 +60,7 @@ class TestDocumentCreate:
|
||||
def test_invalid_kb_id(self, WebApiAuth):
|
||||
res = create_document(WebApiAuth, {"name": "ragflow_test.txt", "kb_id": "invalid_kb_id"})
|
||||
assert res["code"] == 102, res
|
||||
assert res["message"] == "Can't find this knowledgebase!", res
|
||||
assert res["message"] == "Can't find this dataset!", res
|
||||
|
||||
@pytest.mark.p3
|
||||
def test_filename_special_characters(self, WebApiAuth, add_dataset_func):
|
||||
|
||||
@ -51,7 +51,7 @@ class TestDocumentsList:
|
||||
"kb_id, expected_code, expected_message",
|
||||
[
|
||||
("", 101, 'Lack of "KB ID"'),
|
||||
("invalid_dataset_id", 103, "Only owner of knowledgebase authorized for this operation."),
|
||||
("invalid_dataset_id", 103, "Only owner of dataset authorized for this operation."),
|
||||
],
|
||||
)
|
||||
def test_invalid_dataset_id(self, WebApiAuth, kb_id, expected_code, expected_message):
|
||||
|
||||
@ -136,7 +136,7 @@ class TestDocumentsUpload:
|
||||
fp = create_txt_file(tmp_path / "ragflow_test.txt")
|
||||
res = upload_documents(WebApiAuth, {"kb_id": "invalid_kb_id"}, [fp])
|
||||
assert res["code"] == 100, res
|
||||
assert res["message"] == """LookupError("Can't find this knowledgebase!")""", res
|
||||
assert res["message"] == """LookupError("Can't find this dataset!")""", res
|
||||
|
||||
@pytest.mark.p2
|
||||
def test_duplicate_files(self, WebApiAuth, add_dataset_func, tmp_path):
|
||||
|
||||
@ -50,4 +50,4 @@ class TestDatasetsDetail:
|
||||
payload = {"kb_id": "d94a8dc02c9711f0930f7fbc369eab6d"}
|
||||
res = detail_kb(WebApiAuth, payload)
|
||||
assert res["code"] == 103, res
|
||||
assert "Only owner of knowledgebase authorized for this operation." in res["message"], res
|
||||
assert "Only owner of dataset authorized for this operation." in res["message"], res
|
||||
|
||||
@ -111,7 +111,7 @@ class TestDatasetUpdate:
|
||||
payload = {"name": name, "description": "", "parser_id": "naive", "kb_id": kb_id}
|
||||
res = update_kb(WebApiAuth, payload)
|
||||
assert res["code"] == 102, res
|
||||
assert res["message"] == "Duplicated knowledgebase name.", res
|
||||
assert res["message"] == "Duplicated dataset name.", res
|
||||
|
||||
@pytest.mark.p3
|
||||
def test_name_case_insensitive(self, WebApiAuth, add_datasets_func):
|
||||
@ -120,7 +120,7 @@ class TestDatasetUpdate:
|
||||
payload = {"name": name, "description": "", "parser_id": "naive", "kb_id": kb_id}
|
||||
res = update_kb(WebApiAuth, payload)
|
||||
assert res["code"] == 102, res
|
||||
assert res["message"] == "Duplicated knowledgebase name.", res
|
||||
assert res["message"] == "Duplicated dataset name.", res
|
||||
|
||||
@pytest.mark.p2
|
||||
def test_avatar(self, WebApiAuth, add_dataset_func, tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user