Files
versitygw/tests/test_rest_get_bucket_policy_status.sh
T
2026-05-05 19:07:56 -03:00

62 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bats
# Copyright 2025 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.
load ./bats-support/load
load ./bats-assert/load
source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/get_bucket_policy_status/get_bucket_policy_status_rest.sh
source ./tests/drivers/put_bucket_policy/put_bucket_policy_rest.sh
source ./tests/util/util_public_access_block.sh
source ./tests/setup.sh
# tags: curl,GetBucketPolicyStatus,policy,policyStatus
@test "REST - GetBucketPolicyStatus" {
run get_bucket_name "$BUCKET_ONE_NAME"
assert_success
bucket_name="$output"
run setup_bucket_v2 "$bucket_name"
assert_success
run put_simple_bucket_policy "$bucket_name"
assert_success
run get_and_check_policy_status "$bucket_name" "false"
assert_success
}
# tags: curl,GetBucketPolicyStatus,policy,policyStatus,public-access
@test "REST - GetBucketPolicyStatus true" {
run get_bucket_name "$BUCKET_ONE_NAME"
assert_success
bucket_name="$output"
run setup_bucket_v2 "$bucket_name"
assert_success
if [ "$DIRECT" == "true" ]; then
run allow_public_access "$bucket_name"
assert_success
fi
run put_public_bucket_policy "$bucket_name"
assert_success
run get_and_check_policy_status "$bucket_name" "true"
assert_success
}