From 7c502a858100bd5087c1026d2d83cfbe7fde0be8 Mon Sep 17 00:00:00 2001 From: "stonezdj(Daojun Zhang)" Date: Tue, 14 Jan 2025 14:48:50 +0800 Subject: [PATCH] Remove id field from payload when update purge audit or gc schedule (#21408) Signed-off-by: stonezdj --- tests/apitests/python/test_system_permission.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/apitests/python/test_system_permission.py b/tests/apitests/python/test_system_permission.py index 4e5cb667bf..5677934e80 100644 --- a/tests/apitests/python/test_system_permission.py +++ b/tests/apitests/python/test_system_permission.py @@ -32,6 +32,9 @@ class Permission: def call(self): if ID_PLACEHOLDER in self.url: self.url = self.url.replace(ID_PLACEHOLDER, str(self.payload.get(self.payload_id_field))) + # remove the id field in the payload when calling the gc and purgeaudit schedule api with PUT method + if self.method == "PUT" and (self.url.endswith("system/gc/schedule") or self.url.endswith("system/purgeaudit/schedule")): + self.payload.pop("id", None) response = requests.request(self.method, self.url, data=json.dumps(self.payload), verify=False, auth=(user_name, password), headers={"Content-Type": "application/json"}) if self.expect_status_code == None: assert response.status_code != 403, "Failed to call the {} {}, expected status code is not 403, but got {}, error msg is {}".format(self.method, self.url, response.status_code, response.text)