From 4947e9473ae6041387188290089f623054534147 Mon Sep 17 00:00:00 2001 From: Liu An Date: Fri, 30 Jan 2026 09:45:04 +0800 Subject: [PATCH] Fix(test): Update error message assertions for unsupported content type tests (#12901) ### What problem does this PR solve? This commit updates test cases for create, delete, and update dataset endpoints to expect consistent error messages when an unsupported content type is provided. ### Type of change - [x] Bug Fix (test) --- .../test_dataset_management/test_create_dataset.py | 2 +- .../test_dataset_management/test_delete_datasets.py | 2 +- .../test_dataset_management/test_update_dataset.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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: " 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: " 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(