mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 00:55:10 +08:00
Fix(test): downgrade test priorities (#12913)
### What problem does this PR solve? Changed test priorities in multiple test files, downgrading from p1 to p2 and p2 to p3. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
4
codecov.yml
Normal file
4
codecov.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project: off
|
||||||
|
patch: off
|
||||||
@ -25,7 +25,7 @@ from configs import EMAIL, HOST_ADDRESS, PASSWORD, VERSION
|
|||||||
|
|
||||||
|
|
||||||
class TestDeleteUserApiKey:
|
class TestDeleteUserApiKey:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_delete_user_api_key_success(self, admin_session: requests.Session) -> None:
|
def test_delete_user_api_key_success(self, admin_session: requests.Session) -> None:
|
||||||
"""Test successfully deleting an API key for a user"""
|
"""Test successfully deleting an API key for a user"""
|
||||||
user_name: str = EMAIL
|
user_name: str = EMAIL
|
||||||
@ -45,7 +45,7 @@ class TestDeleteUserApiKey:
|
|||||||
message: str = delete_response.get("message", "")
|
message: str = delete_response.get("message", "")
|
||||||
assert message == "API key deleted successfully", f"Message should indicate success, got: {message}"
|
assert message == "API key deleted successfully", f"Message should indicate success, got: {message}"
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_user_api_key_removed_from_list_after_deletion(self, admin_session: requests.Session) -> None:
|
def test_user_api_key_removed_from_list_after_deletion(self, admin_session: requests.Session) -> None:
|
||||||
"""Test that deleted API key is removed from the list"""
|
"""Test that deleted API key is removed from the list"""
|
||||||
user_name: str = EMAIL
|
user_name: str = EMAIL
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from configs import EMAIL
|
|||||||
|
|
||||||
|
|
||||||
class TestGenerateUserApiKey:
|
class TestGenerateUserApiKey:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_generate_user_api_key_success(self, admin_session: requests.Session) -> None:
|
def test_generate_user_api_key_success(self, admin_session: requests.Session) -> None:
|
||||||
"""Test successfully generating API key for a user"""
|
"""Test successfully generating API key for a user"""
|
||||||
# Use the test user email (get_user_details expects email)
|
# Use the test user email (get_user_details expects email)
|
||||||
@ -63,7 +63,7 @@ class TestGenerateUserApiKey:
|
|||||||
token_without_prefix: str = token.replace("ragflow-", "")[:32]
|
token_without_prefix: str = token.replace("ragflow-", "")[:32]
|
||||||
assert beta != token_without_prefix, "Beta should be independently generated, not derived from token"
|
assert beta != token_without_prefix, "Beta should be independently generated, not derived from token"
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_generate_user_api_key_appears_in_list(self, admin_session: requests.Session) -> None:
|
def test_generate_user_api_key_appears_in_list(self, admin_session: requests.Session) -> None:
|
||||||
"""Test that generated API key appears in get_user_api_key list"""
|
"""Test that generated API key appears in get_user_api_key list"""
|
||||||
user_name: str = EMAIL
|
user_name: str = EMAIL
|
||||||
@ -84,7 +84,7 @@ class TestGenerateUserApiKey:
|
|||||||
token_found: bool = any(key.get("token") == token for key in api_keys)
|
token_found: bool = any(key.get("token") == token for key in api_keys)
|
||||||
assert token_found, "Generated API key should appear in the list"
|
assert token_found, "Generated API key should appear in the list"
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_generate_user_api_key_response_structure(self, admin_session: requests.Session) -> None:
|
def test_generate_user_api_key_response_structure(self, admin_session: requests.Session) -> None:
|
||||||
"""Test that generate_user_api_key returns correct response structure"""
|
"""Test that generate_user_api_key returns correct response structure"""
|
||||||
user_name: str = EMAIL
|
user_name: str = EMAIL
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from configs import EMAIL
|
|||||||
|
|
||||||
|
|
||||||
class TestGetUserApiKey:
|
class TestGetUserApiKey:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_get_user_api_key_success(self, admin_session: requests.Session) -> None:
|
def test_get_user_api_key_success(self, admin_session: requests.Session) -> None:
|
||||||
"""Test successfully getting API keys for a user with correct response structure"""
|
"""Test successfully getting API keys for a user with correct response structure"""
|
||||||
user_name: str = EMAIL
|
user_name: str = EMAIL
|
||||||
|
|||||||
@ -209,7 +209,7 @@ class TestAddChunk:
|
|||||||
assert False, res
|
assert False, res
|
||||||
assert res["data"]["doc"]["chunk_count"] == chunks_count + 2
|
assert res["data"]["doc"]["chunk_count"] == chunks_count + 2
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_add_chunk_to_deleted_document(self, HttpApiAuth, add_document):
|
def test_add_chunk_to_deleted_document(self, HttpApiAuth, add_document):
|
||||||
dataset_id, document_id = add_document
|
dataset_id, document_id = add_document
|
||||||
delete_documents(HttpApiAuth, dataset_id, {"ids": [document_id]})
|
delete_documents(HttpApiAuth, dataset_id, {"ids": [document_id]})
|
||||||
|
|||||||
@ -151,7 +151,7 @@ class TestDatasetCreate:
|
|||||||
res = create_dataset(HttpApiAuth, payload)
|
res = create_dataset(HttpApiAuth, payload)
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_avatar_exceeds_limit_length(self, HttpApiAuth):
|
def test_avatar_exceeds_limit_length(self, HttpApiAuth):
|
||||||
payload = {"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536}
|
payload = {"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536}
|
||||||
res = create_dataset(HttpApiAuth, payload)
|
res = create_dataset(HttpApiAuth, payload)
|
||||||
@ -200,7 +200,7 @@ class TestDatasetCreate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["description"] == "description", res
|
assert res["data"]["description"] == "description", res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_description_exceeds_limit_length(self, HttpApiAuth):
|
def test_description_exceeds_limit_length(self, HttpApiAuth):
|
||||||
payload = {"name": "description_exceeds_limit_length", "description": "a" * 65536}
|
payload = {"name": "description_exceeds_limit_length", "description": "a" * 65536}
|
||||||
res = create_dataset(HttpApiAuth, payload)
|
res = create_dataset(HttpApiAuth, payload)
|
||||||
@ -293,7 +293,7 @@ class TestDatasetCreate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["embedding_model"] == "BAAI/bge-small-en-v1.5@Builtin", res
|
assert res["data"]["embedding_model"] == "BAAI/bge-small-en-v1.5@Builtin", res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"name, permission",
|
"name, permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class TestDatasetsDelete:
|
|||||||
res = list_datasets(HttpApiAuth)
|
res = list_datasets(HttpApiAuth)
|
||||||
assert len(res["data"]) == remaining, res
|
assert len(res["data"]) == remaining, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.usefixtures("add_dataset_func")
|
@pytest.mark.usefixtures("add_dataset_func")
|
||||||
def test_ids_empty(self, HttpApiAuth):
|
def test_ids_empty(self, HttpApiAuth):
|
||||||
payload = {"ids": []}
|
payload = {"ids": []}
|
||||||
@ -126,7 +126,7 @@ class TestDatasetsDelete:
|
|||||||
res = list_datasets(HttpApiAuth)
|
res = list_datasets(HttpApiAuth)
|
||||||
assert len(res["data"]) == 1, res
|
assert len(res["data"]) == 1, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p3
|
||||||
@pytest.mark.usefixtures("add_datasets_func")
|
@pytest.mark.usefixtures("add_datasets_func")
|
||||||
def test_ids_none(self, HttpApiAuth):
|
def test_ids_none(self, HttpApiAuth):
|
||||||
payload = {"ids": None}
|
payload = {"ids": None}
|
||||||
@ -208,7 +208,7 @@ class TestDatasetsDelete:
|
|||||||
assert res["code"] == 108, res
|
assert res["code"] == 108, res
|
||||||
assert "lacks permission for dataset" in res["message"], res
|
assert "lacks permission for dataset" in res["message"], res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.usefixtures("add_dataset_func")
|
@pytest.mark.usefixtures("add_dataset_func")
|
||||||
def test_field_unsupported(self, HttpApiAuth):
|
def test_field_unsupported(self, HttpApiAuth):
|
||||||
payload = {"unknown_field": "unknown_field"}
|
payload = {"unknown_field": "unknown_field"}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowHttpApiAuth
|
from libs.auth import RAGFlowHttpApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class TestCapability:
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("add_datasets")
|
@pytest.mark.usefixtures("add_datasets")
|
||||||
class TestDatasetsList:
|
class TestDatasetsList:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, HttpApiAuth):
|
def test_params_unset(self, HttpApiAuth):
|
||||||
res = list_datasets(HttpApiAuth, None)
|
res = list_datasets(HttpApiAuth, None)
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
@ -142,7 +142,7 @@ class TestDatasetsList:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert len(res["data"]) == 5, res
|
assert len(res["data"]) == 5, res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"params, assertions",
|
"params, assertions",
|
||||||
[
|
[
|
||||||
@ -334,7 +334,7 @@ class TestDatasetsList:
|
|||||||
assert res["code"] == 108, res
|
assert res["code"] == 108, res
|
||||||
assert "lacks permission for dataset" in res["message"], res
|
assert "lacks permission for dataset" in res["message"], res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_field_unsupported(self, HttpApiAuth):
|
def test_field_unsupported(self, HttpApiAuth):
|
||||||
params = {"unknown_field": "unknown_field"}
|
params = {"unknown_field": "unknown_field"}
|
||||||
res = list_datasets(HttpApiAuth, params)
|
res = list_datasets(HttpApiAuth, params)
|
||||||
|
|||||||
@ -187,7 +187,7 @@ class TestDatasetUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"][0]["avatar"] == f"data:image/png;base64,{encode_avatar(fn)}", res
|
assert res["data"][0]["avatar"] == f"data:image/png;base64,{encode_avatar(fn)}", res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_avatar_exceeds_limit_length(self, HttpApiAuth, add_dataset_func):
|
def test_avatar_exceeds_limit_length(self, HttpApiAuth, add_dataset_func):
|
||||||
dataset_id = add_dataset_func
|
dataset_id = add_dataset_func
|
||||||
payload = {"avatar": "a" * 65536}
|
payload = {"avatar": "a" * 65536}
|
||||||
@ -236,7 +236,7 @@ class TestDatasetUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"][0]["description"] == "description"
|
assert res["data"][0]["description"] == "description"
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_description_exceeds_limit_length(self, HttpApiAuth, add_dataset_func):
|
def test_description_exceeds_limit_length(self, HttpApiAuth, add_dataset_func):
|
||||||
dataset_id = add_dataset_func
|
dataset_id = add_dataset_func
|
||||||
payload = {"description": "a" * 65536}
|
payload = {"description": "a" * 65536}
|
||||||
@ -330,7 +330,7 @@ class TestDatasetUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"][0]["embedding_model"] == "BAAI/bge-small-en-v1.5@Builtin", res
|
assert res["data"][0]["embedding_model"] == "BAAI/bge-small-en-v1.5@Builtin", res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"permission",
|
"permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class TestDocumentsUpload:
|
|||||||
assert res["data"][0]["dataset_id"] == dataset_id
|
assert res["data"][0]["dataset_id"] == dataset_id
|
||||||
assert res["data"][0]["name"] == fp.name
|
assert res["data"][0]["name"] == fp.name
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"file_type",
|
"file_type",
|
||||||
["exe", "unknown"],
|
["exe", "unknown"],
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class TestChatAssistantCreate:
|
|||||||
chat_assistant = client.create_chat(name="avatar_test", avatar=encode_avatar(fn), dataset_ids=[])
|
chat_assistant = client.create_chat(name="avatar_test", avatar=encode_avatar(fn), dataset_ids=[])
|
||||||
assert chat_assistant.name == "avatar_test"
|
assert chat_assistant.name == "avatar_test"
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"llm, expected_message",
|
"llm, expected_message",
|
||||||
[
|
[
|
||||||
@ -137,7 +137,7 @@ class TestChatAssistantCreate:
|
|||||||
assert attrgetter("frequency_penalty")(chat_assistant.llm) == 0.7
|
assert attrgetter("frequency_penalty")(chat_assistant.llm) == 0.7
|
||||||
assert attrgetter("max_tokens")(chat_assistant.llm) == 512
|
assert attrgetter("max_tokens")(chat_assistant.llm) == 512
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"prompt, expected_message",
|
"prompt, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_datasets")
|
@pytest.mark.usefixtures("clear_datasets")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -117,7 +117,7 @@ class TestDatasetCreate:
|
|||||||
}
|
}
|
||||||
client.create_dataset(**payload)
|
client.create_dataset(**payload)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_avatar_exceeds_limit_length(self, client):
|
def test_avatar_exceeds_limit_length(self, client):
|
||||||
payload = {"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536}
|
payload = {"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536}
|
||||||
with pytest.raises(Exception) as exception_info:
|
with pytest.raises(Exception) as exception_info:
|
||||||
@ -157,7 +157,7 @@ class TestDatasetCreate:
|
|||||||
dataset = client.create_dataset(**payload)
|
dataset = client.create_dataset(**payload)
|
||||||
assert dataset.description == "description", str(dataset)
|
assert dataset.description == "description", str(dataset)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_description_exceeds_limit_length(self, client):
|
def test_description_exceeds_limit_length(self, client):
|
||||||
payload = {"name": "description_exceeds_limit_length", "description": "a" * 65536}
|
payload = {"name": "description_exceeds_limit_length", "description": "a" * 65536}
|
||||||
with pytest.raises(Exception) as exception_info:
|
with pytest.raises(Exception) as exception_info:
|
||||||
@ -245,7 +245,7 @@ class TestDatasetCreate:
|
|||||||
dataset = client.create_dataset(**payload)
|
dataset = client.create_dataset(**payload)
|
||||||
assert dataset.embedding_model == "BAAI/bge-small-en-v1.5@Builtin", str(dataset)
|
assert dataset.embedding_model == "BAAI/bge-small-en-v1.5@Builtin", str(dataset)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"name, permission",
|
"name, permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from ragflow_sdk import RAGFlow
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -79,7 +79,7 @@ class TestDatasetsDelete:
|
|||||||
datasets = client.list_datasets()
|
datasets = client.list_datasets()
|
||||||
assert len(datasets) == remaining, str(datasets)
|
assert len(datasets) == remaining, str(datasets)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.usefixtures("add_dataset_func")
|
@pytest.mark.usefixtures("add_dataset_func")
|
||||||
def test_ids_empty(self, client):
|
def test_ids_empty(self, client):
|
||||||
payload = {"ids": []}
|
payload = {"ids": []}
|
||||||
@ -88,7 +88,7 @@ class TestDatasetsDelete:
|
|||||||
datasets = client.list_datasets()
|
datasets = client.list_datasets()
|
||||||
assert len(datasets) == 1, str(datasets)
|
assert len(datasets) == 1, str(datasets)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p3
|
||||||
@pytest.mark.usefixtures("add_datasets_func")
|
@pytest.mark.usefixtures("add_datasets_func")
|
||||||
def test_ids_none(self, client):
|
def test_ids_none(self, client):
|
||||||
payload = {"ids": None}
|
payload = {"ids": None}
|
||||||
@ -167,7 +167,7 @@ class TestDatasetsDelete:
|
|||||||
client.delete_datasets(**payload)
|
client.delete_datasets(**payload)
|
||||||
assert "lacks permission for dataset" in str(exception_info.value), str(exception_info.value)
|
assert "lacks permission for dataset" in str(exception_info.value), str(exception_info.value)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.usefixtures("add_dataset_func")
|
@pytest.mark.usefixtures("add_dataset_func")
|
||||||
def test_field_unsupported(self, client):
|
def test_field_unsupported(self, client):
|
||||||
payload = {"unknown_field": "unknown_field"}
|
payload = {"unknown_field": "unknown_field"}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from ragflow_sdk import RAGFlow
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -54,7 +54,7 @@ class TestCapability:
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("add_datasets")
|
@pytest.mark.usefixtures("add_datasets")
|
||||||
class TestDatasetsList:
|
class TestDatasetsList:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, client):
|
def test_params_unset(self, client):
|
||||||
datasets = client.list_datasets()
|
datasets = client.list_datasets()
|
||||||
assert len(datasets) == 5, str(datasets)
|
assert len(datasets) == 5, str(datasets)
|
||||||
@ -135,7 +135,7 @@ class TestDatasetsList:
|
|||||||
client.list_datasets(**params)
|
client.list_datasets(**params)
|
||||||
assert "not instance of" in str(exception_info.value), str(exception_info.value)
|
assert "not instance of" in str(exception_info.value), str(exception_info.value)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"params",
|
"params",
|
||||||
[
|
[
|
||||||
@ -171,7 +171,7 @@ class TestDatasetsList:
|
|||||||
client.list_datasets(**params)
|
client.list_datasets(**params)
|
||||||
assert "not instance of" in str(exception_info.value), str(exception_info.value)
|
assert "not instance of" in str(exception_info.value), str(exception_info.value)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"params",
|
"params",
|
||||||
[
|
[
|
||||||
@ -306,7 +306,7 @@ class TestDatasetsList:
|
|||||||
client.list_datasets(**params)
|
client.list_datasets(**params)
|
||||||
assert "lacks permission for dataset" in str(exception_info.value), str(exception_info.value)
|
assert "lacks permission for dataset" in str(exception_info.value), str(exception_info.value)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_field_unsupported(self, client):
|
def test_field_unsupported(self, client):
|
||||||
params = {"unknown_field": "unknown_field"}
|
params = {"unknown_field": "unknown_field"}
|
||||||
with pytest.raises(Exception) as exception_info:
|
with pytest.raises(Exception) as exception_info:
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class TestDatasetUpdate:
|
|||||||
retrieved_dataset = client.get_dataset(name=dataset.name)
|
retrieved_dataset = client.get_dataset(name=dataset.name)
|
||||||
assert retrieved_dataset.avatar == avatar_data, str(retrieved_dataset)
|
assert retrieved_dataset.avatar == avatar_data, str(retrieved_dataset)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_avatar_exceeds_limit_length(self, add_dataset_func):
|
def test_avatar_exceeds_limit_length(self, add_dataset_func):
|
||||||
dataset = add_dataset_func
|
dataset = add_dataset_func
|
||||||
with pytest.raises(Exception) as exception_info:
|
with pytest.raises(Exception) as exception_info:
|
||||||
@ -148,7 +148,7 @@ class TestDatasetUpdate:
|
|||||||
retrieved_dataset = client.get_dataset(name=dataset.name)
|
retrieved_dataset = client.get_dataset(name=dataset.name)
|
||||||
assert retrieved_dataset.description == "description", str(retrieved_dataset)
|
assert retrieved_dataset.description == "description", str(retrieved_dataset)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_description_exceeds_limit_length(self, add_dataset_func):
|
def test_description_exceeds_limit_length(self, add_dataset_func):
|
||||||
dataset = add_dataset_func
|
dataset = add_dataset_func
|
||||||
with pytest.raises(Exception) as exception_info:
|
with pytest.raises(Exception) as exception_info:
|
||||||
@ -235,7 +235,7 @@ class TestDatasetUpdate:
|
|||||||
retrieved_dataset = client.get_dataset(name=dataset.name)
|
retrieved_dataset = client.get_dataset(name=dataset.name)
|
||||||
assert retrieved_dataset.embedding_model == "BAAI/bge-small-en-v1.5@Builtin", str(retrieved_dataset)
|
assert retrieved_dataset.embedding_model == "BAAI/bge-small-en-v1.5@Builtin", str(retrieved_dataset)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"permission",
|
"permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class TestDocumentsUpload:
|
|||||||
assert document.dataset_id == dataset.id, str(document)
|
assert document.dataset_id == dataset.id, str(document)
|
||||||
assert document.name == fp.name, str(document)
|
assert document.name == fp.name, str(document)
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"file_type",
|
"file_type",
|
||||||
["exe", "unknown"],
|
["exe", "unknown"],
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from ragflow_sdk import RAGFlow
|
|||||||
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -47,13 +47,13 @@ class TestCapability:
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("add_memory_func")
|
@pytest.mark.usefixtures("add_memory_func")
|
||||||
class TestMemoryList:
|
class TestMemoryList:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, client):
|
def test_params_unset(self, client):
|
||||||
res = client.list_memory()
|
res = client.list_memory()
|
||||||
assert len(res["memory_list"]) == 3, str(res)
|
assert len(res["memory_list"]) == 3, str(res)
|
||||||
assert res["total_count"] == 3, str(res)
|
assert res["total_count"] == 3, str(res)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_empty(self, client):
|
def test_params_empty(self, client):
|
||||||
res = client.list_memory(**{})
|
res = client.list_memory(**{})
|
||||||
assert len(res["memory_list"]) == 3, str(res)
|
assert len(res["memory_list"]) == 3, str(res)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from ragflow_sdk import RAGFlow
|
|||||||
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -84,7 +84,7 @@ class TestMemoryUpdate:
|
|||||||
res_1 = memory_1.update(update_dict)
|
res_1 = memory_1.update(update_dict)
|
||||||
assert res_1.name == "Test_Memory(1)", str(res_1)
|
assert res_1.name == "Test_Memory(1)", str(res_1)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_avatar(self, client, tmp_path):
|
def test_avatar(self, client, tmp_path):
|
||||||
memory_ids = self.memory_ids
|
memory_ids = self.memory_ids
|
||||||
fn = create_image_file(tmp_path / "ragflow_test.png")
|
fn = create_image_file(tmp_path / "ragflow_test.png")
|
||||||
@ -93,7 +93,7 @@ class TestMemoryUpdate:
|
|||||||
res = memory.update(update_dict)
|
res = memory.update(update_dict)
|
||||||
assert res.avatar == f"data:image/png;base64,{encode_avatar(fn)}", str(res)
|
assert res.avatar == f"data:image/png;base64,{encode_avatar(fn)}", str(res)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_description(self, client):
|
def test_description(self, client):
|
||||||
memory_ids = self.memory_ids
|
memory_ids = self.memory_ids
|
||||||
description = "This is a test description."
|
description = "This is a test description."
|
||||||
@ -111,7 +111,7 @@ class TestMemoryUpdate:
|
|||||||
res = memory.update(update_dict)
|
res = memory.update(update_dict)
|
||||||
assert res.llm_id == llm_id, str(res)
|
assert res.llm_id == llm_id, str(res)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"permission",
|
"permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from ragflow_sdk import RAGFlow, Memory
|
|||||||
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from ragflow_sdk import RAGFlow, Memory
|
|||||||
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
@ -41,14 +41,14 @@ class TestAuthorization:
|
|||||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||||
class TestMessageList:
|
class TestMessageList:
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, client):
|
def test_params_unset(self, client):
|
||||||
memory_id = self.memory_id
|
memory_id = self.memory_id
|
||||||
memory = Memory(client, {"id": memory_id})
|
memory = Memory(client, {"id": memory_id})
|
||||||
res = memory.list_memory_messages()
|
res = memory.list_memory_messages()
|
||||||
assert len(res["messages"]["message_list"]) == 5, str(res)
|
assert len(res["messages"]["message_list"]) == 5, str(res)
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_empty(self, client):
|
def test_params_empty(self, client):
|
||||||
memory_id = self.memory_id
|
memory_id = self.memory_id
|
||||||
memory = Memory(client, {"id": memory_id})
|
memory = Memory(client, {"id": memory_id})
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from ragflow_sdk import RAGFlow, Memory
|
|||||||
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN, HOST_ADDRESS
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_message",
|
"invalid_auth, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -36,7 +36,7 @@ def validate_chunk_details(auth, kb_id, doc_id, payload, res):
|
|||||||
assert chunk["question_kwd"] == expected
|
assert chunk["question_kwd"] == expected
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -26,7 +26,7 @@ from common import create_dialog
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_dialogs")
|
@pytest.mark.usefixtures("clear_dialogs")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_dialogs")
|
@pytest.mark.usefixtures("clear_dialogs")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_dialogs")
|
@pytest.mark.usefixtures("clear_dialogs")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_dialogs")
|
@pytest.mark.usefixtures("clear_dialogs")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_dialogs")
|
@pytest.mark.usefixtures("clear_dialogs")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -48,7 +48,7 @@ class TestDialogUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["name"] == new_name, res
|
assert res["data"]["name"] == new_name, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_update_description(self, WebApiAuth, add_dialog_func):
|
def test_update_description(self, WebApiAuth, add_dialog_func):
|
||||||
_, dialog_id = add_dialog_func
|
_, dialog_id = add_dialog_func
|
||||||
new_description = "Updated description"
|
new_description = "Updated description"
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
from utils import is_sorted
|
from utils import is_sorted
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -63,7 +63,7 @@ def validate_document_parse_cancel(auth, _kb_id, _document_ids):
|
|||||||
assert doc["progress"] == 0.0
|
assert doc["progress"] == 0.0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class TestDocumentsUpload:
|
|||||||
assert res["data"][0]["kb_id"] == kb_id, res
|
assert res["data"][0]["kb_id"] == kb_id, res
|
||||||
assert res["data"][0]["name"] == fp.name, res
|
assert res["data"][0]["name"] == fp.name, res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"file_type",
|
"file_type",
|
||||||
["exe", "unknown"],
|
["exe", "unknown"],
|
||||||
@ -113,7 +113,7 @@ class TestDocumentsUpload:
|
|||||||
assert res["code"] == 101, res
|
assert res["code"] == 101, res
|
||||||
assert res["message"] == "No file selected!", res
|
assert res["message"] == "No file selected!", res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
def test_filename_exceeds_max_length(self, WebApiAuth, add_dataset_func, tmp_path):
|
def test_filename_exceeds_max_length(self, WebApiAuth, add_dataset_func, tmp_path):
|
||||||
kb_id = add_dataset_func
|
kb_id = add_dataset_func
|
||||||
fp = create_txt_file(tmp_path / f"{'a' * (DOCUMENT_NAME_LIMIT - 4)}.txt")
|
fp = create_txt_file(tmp_path / f"{'a' * (DOCUMENT_NAME_LIMIT - 4)}.txt")
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("clear_datasets")
|
@pytest.mark.usefixtures("clear_datasets")
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from utils import is_sorted
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -50,7 +50,7 @@ class TestCapability:
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("add_datasets")
|
@pytest.mark.usefixtures("add_datasets")
|
||||||
class TestDatasetsList:
|
class TestDatasetsList:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, WebApiAuth):
|
def test_params_unset(self, WebApiAuth):
|
||||||
res = list_kbs(WebApiAuth, None)
|
res = list_kbs(WebApiAuth, None)
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
@ -139,7 +139,7 @@ class TestDatasetsList:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert len(res["data"]["kbs"]) == 5, res
|
assert len(res["data"]["kbs"]) == 5, res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"params, assertions",
|
"params, assertions",
|
||||||
[
|
[
|
||||||
@ -153,7 +153,7 @@ class TestDatasetsList:
|
|||||||
if callable(assertions):
|
if callable(assertions):
|
||||||
assert assertions(res), res
|
assert assertions(res), res
|
||||||
|
|
||||||
@pytest.mark.p2
|
@pytest.mark.p3
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"params, assertions",
|
"params, assertions",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -162,7 +162,7 @@ class TestDatasetUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["embd_id"] == embedding_model, res
|
assert res["data"]["embd_id"] == embedding_model, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"permission",
|
"permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -26,14 +26,14 @@ INVALID_AUTH_CASES = [
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
||||||
def test_auth_invalid_factories(self, invalid_auth, expected_code, expected_message):
|
def test_auth_invalid_factories(self, invalid_auth, expected_code, expected_message):
|
||||||
res = llm_factories(invalid_auth)
|
res = llm_factories(invalid_auth)
|
||||||
assert res["code"] == expected_code, res
|
assert res["code"] == expected_code, res
|
||||||
assert res["message"] == expected_message, res
|
assert res["message"] == expected_message, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
||||||
def test_auth_invalid_list(self, invalid_auth, expected_code, expected_message):
|
def test_auth_invalid_list(self, invalid_auth, expected_code, expected_message):
|
||||||
res = llm_list(invalid_auth)
|
res = llm_list(invalid_auth)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -47,12 +47,12 @@ class TestCapability:
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("add_memory_func")
|
@pytest.mark.usefixtures("add_memory_func")
|
||||||
class TestMemoryList:
|
class TestMemoryList:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, WebApiAuth):
|
def test_params_unset(self, WebApiAuth):
|
||||||
res = list_memory(WebApiAuth, None)
|
res = list_memory(WebApiAuth, None)
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_empty(self, WebApiAuth):
|
def test_params_empty(self, WebApiAuth):
|
||||||
res = list_memory(WebApiAuth, {})
|
res = list_memory(WebApiAuth, {})
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from utils.hypothesis_utils import valid_names
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -80,7 +80,7 @@ class TestMemoryUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["name"] == "Test_Memory(1)", res
|
assert res["data"]["name"] == "Test_Memory(1)", res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_avatar(self, WebApiAuth, add_memory_func, tmp_path):
|
def test_avatar(self, WebApiAuth, add_memory_func, tmp_path):
|
||||||
memory_ids = add_memory_func
|
memory_ids = add_memory_func
|
||||||
fn = create_image_file(tmp_path / "ragflow_test.png")
|
fn = create_image_file(tmp_path / "ragflow_test.png")
|
||||||
@ -89,7 +89,7 @@ class TestMemoryUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["avatar"] == f"data:image/png;base64,{encode_avatar(fn)}", res
|
assert res["data"]["avatar"] == f"data:image/png;base64,{encode_avatar(fn)}", res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_description(self, WebApiAuth, add_memory_func):
|
def test_description(self, WebApiAuth, add_memory_func):
|
||||||
memory_ids = add_memory_func
|
memory_ids = add_memory_func
|
||||||
description = "This is a test description."
|
description = "This is a test description."
|
||||||
@ -107,7 +107,7 @@ class TestMemoryUpdate:
|
|||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert res["data"]["llm_id"] == llm_id, res
|
assert res["data"]["llm_id"] == llm_id, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"permission",
|
"permission",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
@ -40,14 +40,14 @@ class TestAuthorization:
|
|||||||
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
@pytest.mark.usefixtures("add_memory_with_5_raw_message_func")
|
||||||
class TestMessageList:
|
class TestMessageList:
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_unset(self, WebApiAuth):
|
def test_params_unset(self, WebApiAuth):
|
||||||
memory_id = self.memory_id
|
memory_id = self.memory_id
|
||||||
res = list_memory_message(WebApiAuth, memory_id, params=None)
|
res = list_memory_message(WebApiAuth, memory_id, params=None)
|
||||||
assert res["code"] == 0, res
|
assert res["code"] == 0, res
|
||||||
assert len(res["data"]["messages"]["message_list"]) == 5, res
|
assert len(res["data"]["messages"]["message_list"]) == 5, res
|
||||||
|
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
def test_params_empty(self, WebApiAuth):
|
def test_params_empty(self, WebApiAuth):
|
||||||
memory_id = self.memory_id
|
memory_id = self.memory_id
|
||||||
res = list_memory_message(WebApiAuth, memory_id, params={})
|
res = list_memory_message(WebApiAuth, memory_id, params={})
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from configs import INVALID_API_TOKEN
|
|||||||
from libs.auth import RAGFlowWebApiAuth
|
from libs.auth import RAGFlowWebApiAuth
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from libs.auth import RAGFlowWebApiAuth
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"invalid_auth, expected_code, expected_message",
|
"invalid_auth, expected_code, expected_message",
|
||||||
[
|
[
|
||||||
|
|||||||
@ -26,7 +26,7 @@ INVALID_AUTH_CASES = [
|
|||||||
|
|
||||||
|
|
||||||
class TestAuthorization:
|
class TestAuthorization:
|
||||||
@pytest.mark.p1
|
@pytest.mark.p2
|
||||||
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
@pytest.mark.parametrize("invalid_auth, expected_code, expected_message", INVALID_AUTH_CASES)
|
||||||
def test_auth_invalid(self, invalid_auth, expected_code, expected_message):
|
def test_auth_invalid(self, invalid_auth, expected_code, expected_message):
|
||||||
res = plugin_llm_tools(invalid_auth)
|
res = plugin_llm_tools(invalid_auth)
|
||||||
|
|||||||
Reference in New Issue
Block a user