Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix(test): Update error message assertions for unsupported content type tests (#12901)

Liu An4947e9473ae6
diff --git a/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py b/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
index 5befa265d6..559b41f3c1 100644
--- a/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
+++ b/test/testcases/test_http_api/test_dataset_management/test_create_dataset.py
@@ -53,7 +53,7 @@ class TestRquest:
BAD_CONTENT_TYPE = "text/xml"
res = create_dataset(HttpApiAuth, {"name": "bad_content_type"}, headers={"Content-Type": BAD_CONTENT_TYPE})
assert res["code"] == 101, res
- assert "Field: <name>" in res["message"], res
+ assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res
@pytest.mark.p3
@pytest.mark.parametrize(
diff --git a/test/testcases/test_http_api/test_dataset_management/test_delete_datasets.py b/test/testcases/test_http_api/test_dataset_management/test_delete_datasets.py
index fb949915f5..1bba3fac9e 100644
--- a/test/testcases/test_http_api/test_dataset_management/test_delete_datasets.py
+++ b/test/testcases/test_http_api/test_dataset_management/test_delete_datasets.py
@@ -51,7 +51,7 @@ class TestRquest:
BAD_CONTENT_TYPE = "text/xml"
res = delete_datasets(HttpApiAuth, headers={"Content-Type": BAD_CONTENT_TYPE})
assert res["code"] == 101, res
- assert "Field: <ids>" in res["message"], res
+ assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res
@pytest.mark.p3
@pytest.mark.parametrize(
diff --git a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
index 85711d95d8..8f84cf0250 100644
--- a/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
+++ b/test/testcases/test_http_api/test_dataset_management/test_update_dataset.py
@@ -56,7 +56,7 @@ class TestRquest:
BAD_CONTENT_TYPE = "text/xml"
res = update_dataset(HttpApiAuth, dataset_id, {"name": "bad_content_type"}, headers={"Content-Type": BAD_CONTENT_TYPE})
assert res["code"] == 101, res
- assert res["message"] == "No properties were modified", res
+ assert res["message"] == f"Unsupported content type: Expected application/json, got {BAD_CONTENT_TYPE}", res
@pytest.mark.p3
@pytest.mark.parametrize(