Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15188,6 +15188,30 @@ def test_object_lock_get_legal_hold():
response = client.get_object_legal_hold(Bucket=bucket_name, Key=key)
assert response["LegalHold"] == legal_hold_off

def test_object_lock_set_legal_hold_off_not_supported():
bucket_name = get_new_bucket_name()
client = get_client()
client.create_bucket(Bucket=bucket_name, ObjectLockEnabledForBucket=True)

key = "file1"
client.put_object(Bucket=bucket_name, Body="abc", Key=key)

legal_hold = {"Status": "ON"}
client.put_object_legal_hold(Bucket=bucket_name, Key=key, LegalHold=legal_hold)
response = client.get_object_legal_hold(Bucket=bucket_name, Key=key)
assert response["LegalHold"] == legal_hold

legal_hold_off = {"Status": "OFF"}
e = assert_raises(
ClientError,
client.put_object_legal_hold,
Bucket=bucket_name,
Key=key,
LegalHold=legal_hold_off,
)

status, error_code = _get_status_and_error_code(e.response)
assert status == 501

def test_object_lock_get_legal_hold_invalid_bucket():
bucket_name = get_new_bucket_name()
Expand Down