Skip to content

Commit

Permalink
DeleteObjects: ensure 400 MalformedXML is returned for empty list
Browse files Browse the repository at this point in the history
Ref: ceph/ceph#60579
Signed-off-by: Seena Fallah <[email protected]>
  • Loading branch information
clwluvw committed Oct 31, 2024
1 parent d245097 commit 94050fd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 94050fd

Please sign in to comment.