From 94050fd11e61a3ac7e23ab513abab88577a72d93 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Thu, 31 Oct 2024 21:07:06 +0100 Subject: [PATCH] DeleteObjects: ensure 400 MalformedXML is returned for empty list Ref: https://github.com/ceph/ceph/pull/60579 Signed-off-by: Seena Fallah --- s3tests_boto3/functional/test_s3.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 85dfba16d..8d1b7e6f3 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -1694,6 +1694,24 @@ def test_multi_object_delete(): response = client.list_objects(Bucket=bucket_name) assert 'Contents' not in response +def test_multi_object_delete_empty_list(): + bucket_name = get_new_bucket() + client = get_client() + + e = assert_raises(ClientError, client.delete_objects, Bucket=bucket_name, Delete={'Objects': [], 'Quiet': False}) + status, error_code = _get_status_and_error_code(e.response) + assert status == 400 + assert error_code == 'MalformedXML' + +def test_multi_object_delete_empty_list_access_forbidden(): + bucket_name = get_new_bucket() + alt_client = get_alt_client() + + e = assert_raises(ClientError, alt_client.delete_objects, Bucket=bucket_name, Delete={'Objects': [], 'Quiet': False}) + status, error_code = _get_status_and_error_code(e.response) + assert status == 400 + assert error_code == 'MalformedXML' + @pytest.mark.list_objects_v2 def test_multi_objectv2_delete(): key_names = ['key0', 'key1', 'key2']