Addition of bucket name when creating a key object (#4824)
This commit is contained in:
parent
ef3a35cd8f
commit
500ed1a90b
@ -1614,6 +1614,7 @@ class S3Backend(BaseBackend, CloudWatchMetricProvider):
|
|||||||
|
|
||||||
new_key = FakeKey(
|
new_key = FakeKey(
|
||||||
name=key_name,
|
name=key_name,
|
||||||
|
bucket_name=bucket_name,
|
||||||
value=value,
|
value=value,
|
||||||
storage=storage,
|
storage=storage,
|
||||||
etag=etag,
|
etag=etag,
|
||||||
|
@ -5315,3 +5315,31 @@ def test_head_versioned_key_in_not_versioned_bucket():
|
|||||||
|
|
||||||
response = ex.value.response
|
response = ex.value.response
|
||||||
assert response["Error"]["Code"] == "400"
|
assert response["Error"]["Code"] == "400"
|
||||||
|
|
||||||
|
|
||||||
|
@mock_s3
|
||||||
|
def test_objects_tagging_with_same_key_name():
|
||||||
|
s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
|
||||||
|
key_name = "file.txt"
|
||||||
|
|
||||||
|
bucket1 = "bucket-1"
|
||||||
|
s3.create_bucket(Bucket=bucket1)
|
||||||
|
tagging = "variable=one"
|
||||||
|
|
||||||
|
s3.put_object(Bucket=bucket1, Body=b"test", Key=key_name, Tagging=tagging)
|
||||||
|
|
||||||
|
bucket2 = "bucket-2"
|
||||||
|
s3.create_bucket(Bucket=bucket2)
|
||||||
|
tagging2 = "variable=two"
|
||||||
|
|
||||||
|
s3.put_object(Bucket=bucket2, Body=b"test", Key=key_name, Tagging=tagging2)
|
||||||
|
|
||||||
|
variable1 = s3.get_object_tagging(Bucket=bucket1, Key=key_name)["TagSet"][0][
|
||||||
|
"Value"
|
||||||
|
]
|
||||||
|
variable2 = s3.get_object_tagging(Bucket=bucket2, Key=key_name)["TagSet"][0][
|
||||||
|
"Value"
|
||||||
|
]
|
||||||
|
|
||||||
|
assert variable1 == "one"
|
||||||
|
assert variable2 == "two"
|
||||||
|
Loading…
Reference in New Issue
Block a user