Include response headers when deleting objects. (#3313)
* Return delete meta. * Add tests. * Lint fixes. Co-authored-by: Leo Sutic <leo.sutic@matterport.com>
This commit is contained in:
parent
9f0f230d13
commit
94543f6e48
3 changed files with 50 additions and 7 deletions
|
|
@ -2315,6 +2315,30 @@ def test_boto3_delete_versioned_bucket():
|
|||
client.delete_bucket(Bucket="blah")
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_delete_versioned_bucket_returns_meta():
|
||||
client = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
|
||||
|
||||
client.create_bucket(Bucket="blah")
|
||||
client.put_bucket_versioning(
|
||||
Bucket="blah", VersioningConfiguration={"Status": "Enabled"}
|
||||
)
|
||||
|
||||
put_resp = client.put_object(Bucket="blah", Key="test1", Body=b"test1")
|
||||
|
||||
# Delete the object
|
||||
del_resp = client.delete_object(Bucket="blah", Key="test1")
|
||||
assert "DeleteMarker" not in del_resp
|
||||
assert del_resp["VersionId"] is not None
|
||||
|
||||
# Delete the delete marker
|
||||
del_resp2 = client.delete_object(
|
||||
Bucket="blah", Key="test1", VersionId=del_resp["VersionId"]
|
||||
)
|
||||
assert del_resp2["DeleteMarker"] == True
|
||||
assert "VersionId" not in del_resp2
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_get_object_if_modified_since():
|
||||
s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue