Merge pull request #2795 from bblommers/feature/657

S3 - Verify content type is set/returned as appropriate
This commit is contained in:
Steve Pulec 2020-03-15 16:41:14 -05:00 committed by GitHub
commit 4cf24701c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ from six.moves.urllib.error import HTTPError
from functools import wraps from functools import wraps
from gzip import GzipFile from gzip import GzipFile
from io import BytesIO from io import BytesIO
import mimetypes
import zlib import zlib
import pickle import pickle
@ -2024,6 +2025,22 @@ def test_boto3_get_object():
e.exception.response["Error"]["Code"].should.equal("NoSuchKey") e.exception.response["Error"]["Code"].should.equal("NoSuchKey")
@mock_s3
def test_boto3_s3_content_type():
s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)
my_bucket = s3.Bucket("my-cool-bucket")
my_bucket.create()
s3_path = "test_s3.py"
s3 = boto3.resource("s3", verify=False)
content_type = "text/python-x"
s3.Object(my_bucket.name, s3_path).put(
ContentType=content_type, Body=b"some python code", ACL="public-read"
)
s3.Object(my_bucket.name, s3_path).content_type.should.equal(content_type)
@mock_s3 @mock_s3
def test_boto3_get_missing_object_with_part_number(): def test_boto3_get_missing_object_with_part_number():
s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)