Add missing default regiono in s3 client (#4194)

This commit is contained in:
Hasanul Islam 2021-08-19 01:25:33 +06:00 committed by GitHub
parent 8743f81e15
commit 492484be20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -5058,7 +5058,7 @@ def test_presigned_put_url_with_custom_headers():
def test_request_partial_content_should_contain_content_length():
bucket = "bucket"
object_key = "key"
s3 = boto3.resource("s3")
s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)
s3.create_bucket(Bucket=bucket)
s3.Object(bucket, object_key).put(Body="some text")
@ -5071,7 +5071,7 @@ def test_request_partial_content_should_contain_content_length():
def test_request_partial_content_should_contain_actual_content_length():
bucket = "bucket"
object_key = "key"
s3 = boto3.resource("s3")
s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)
s3.create_bucket(Bucket=bucket)
s3.Object(bucket, object_key).put(Body="some text")
@ -5123,7 +5123,7 @@ def test_request_partial_content_without_specifying_range_should_return_full_obj
@mock_s3
def test_object_headers():
bucket = "my-bucket"
s3 = boto3.client("s3")
s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
s3.create_bucket(Bucket=bucket)
res = s3.put_object(
@ -5149,8 +5149,8 @@ def test_object_headers():
@mock_s3
def test_get_object_versions_with_prefix():
bucket_name = "testbucket-3113"
s3_resource = boto3.resource("s3")
s3_client = boto3.client("s3")
s3_resource = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)
s3_client = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
s3_client.create_bucket(Bucket=bucket_name)
bucket_versioning = s3_resource.BucketVersioning(bucket_name)
bucket_versioning.enable()

View File

@ -9,7 +9,9 @@ from .test_s3 import DEFAULT_REGION_NAME
@mock_s3
def test_multipart_should_throw_nosuchupload_if_there_are_no_parts():
bucket = boto3.resource("s3").Bucket("randombucketname")
bucket = boto3.resource("s3", region_name=DEFAULT_REGION_NAME).Bucket(
"randombucketname"
)
bucket.create()
s3_object = bucket.Object("my/test2")