Test: update test cases per pr #6144 (#6166)

### What problem does this PR solve?

fix check point per pr #6144 

### Type of change

- [x] update test case
This commit is contained in:
liu an 2025-03-17 16:49:34 +08:00 committed by GitHub
parent 2c3c4274be
commit 45fe02c8b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -235,40 +235,26 @@ class TestDatasetUpdate:
assert res["message"] == "You don't own the dataset" assert res["message"] == "You don't own the dataset"
@pytest.mark.parametrize( @pytest.mark.parametrize(
"payload, expected_code, expected_message", "payload",
[ [
({"chunk_count": 1}, 102, "Can't change `chunk_count`."), {"chunk_count": 1},
(
{"create_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, {"create_date": "Tue, 11 Mar 2025 13:37:23 GMT"},
102, {"create_time": 1741671443322},
"The input parameters are invalid.", {"created_by": "aa"},
), {"document_count": 1},
({"create_time": 1741671443322}, 102, "The input parameters are invalid."), {"id": "id"},
({"created_by": "aa"}, 102, "The input parameters are invalid."), {"status": "1"},
({"document_count": 1}, 102, "Can't change `document_count`."),
({"id": "id"}, 102, "The input parameters are invalid."),
({"status": "1"}, 102, "The input parameters are invalid."),
(
{"tenant_id": "e57c1966f99211efb41e9e45646e0111"}, {"tenant_id": "e57c1966f99211efb41e9e45646e0111"},
102, {"token_num": 1},
"Can't change `tenant_id`.",
),
({"token_num": 1}, 102, "The input parameters are invalid."),
(
{"update_date": "Tue, 11 Mar 2025 13:37:23 GMT"}, {"update_date": "Tue, 11 Mar 2025 13:37:23 GMT"},
102, {"update_time": 1741671443339},
"The input parameters are invalid.",
),
({"update_time": 1741671443339}, 102, "The input parameters are invalid."),
], ],
) )
def test_modify_read_only_field( def test_modify_read_only_field(self, get_http_api_auth, payload):
self, get_http_api_auth, payload, expected_code, expected_message
):
ids = create_datasets(get_http_api_auth, 1) ids = create_datasets(get_http_api_auth, 1)
res = update_dataset(get_http_api_auth, ids[0], payload) res = update_dataset(get_http_api_auth, ids[0], payload)
assert res["code"] == 101 assert res["code"] == 101
#assert res["message"] == expected_message assert "is readonly" in res["message"]
def test_modify_unknown_field(self, get_http_api_auth): def test_modify_unknown_field(self, get_http_api_auth):
ids = create_datasets(get_http_api_auth, 1) ids = create_datasets(get_http_api_auth, 1)