Files
versitygw/tests/drivers/delete_object/delete_object_s3api.sh

32 lines
1.1 KiB
Bash

#!/usr/bin/env bats
# Copyright 2026 Versity Software
# This file is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
block_delete_object_without_permission() {
if ! check_param_count_v2 "bucket, file, username, password" 4 $#; then
return 1
fi
if delete_object_error=$(delete_object_with_user "s3api" "$1" "$2" "$3" "$4" 2>&1); then
log 2 "able to delete object despite lack of permissions"
return 1
fi
# shellcheck disable=SC2154
if [[ "$delete_object_error" != *"AccessDenied"* ]]; then
log 2 "invalid delete object error: $delete_object_error"
return 1
fi
return 0
}