Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag cors tests #581

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ markers =
bucket_encryption
checksum
cloud_transition
cors
encryption
fails_on_aws
fails_on_dbstore
Expand Down
10 changes: 10 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6576,6 +6576,7 @@ def test_100_continue():
status = _simple_http_req_100_cont(host, port, is_secure, 'PUT', resource)
assert status == '100'

@pytest.mark.cors
def test_set_cors():
bucket_name = get_new_bucket()
client = get_client()
Expand Down Expand Up @@ -6611,6 +6612,7 @@ def _cors_request_and_check(func, url, headers, expect_status, expect_allow_orig
assert r.headers.get('access-control-allow-origin', None) == expect_allow_origin
assert r.headers.get('access-control-allow-methods', None) == expect_allow_methods

@pytest.mark.cors
def test_cors_origin_response():
bucket_name = _setup_bucket_acl(bucket_acl='public-read')
client = get_client()
Expand Down Expand Up @@ -6686,6 +6688,7 @@ def test_cors_origin_response():
_cors_request_and_check(requests.options, url, {'Origin': 'foo.put', 'Access-Control-Request-Method': 'GET'}, 403, None, None)
_cors_request_and_check(requests.options, url, {'Origin': 'foo.put', 'Access-Control-Request-Method': 'PUT'}, 200, 'foo.put', 'PUT')

@pytest.mark.cors
def test_cors_origin_wildcard():
bucket_name = _setup_bucket_acl(bucket_acl='public-read')
client = get_client()
Expand All @@ -6711,6 +6714,7 @@ def test_cors_origin_wildcard():
_cors_request_and_check(requests.get, url, None, 200, None, None)
_cors_request_and_check(requests.get, url, {'Origin': 'example.origin'}, 200, '*', 'GET')

@pytest.mark.cors
def test_cors_header_option():
bucket_name = _setup_bucket_acl(bucket_acl='public-read')
client = get_client()
Expand Down Expand Up @@ -6776,37 +6780,43 @@ def _test_cors_options_presigned_method(client, method, cannedACL=None):
_cors_request_and_check(requests.options, url, headers,
200, 'example', httpMethod)

@pytest.mark.cors
def test_cors_presigned_get_object():
_test_cors_options_presigned_method(
client=get_client(),
method='get_object',
)

@pytest.mark.cors
def test_cors_presigned_get_object_tenant():
_test_cors_options_presigned_method(
client=get_tenant_client(),
method='get_object',
)

@pytest.mark.cors
def test_cors_presigned_put_object():
_test_cors_options_presigned_method(
client=get_client(),
method='put_object',
)

@pytest.mark.cors
def test_cors_presigned_put_object_with_acl():
_test_cors_options_presigned_method(
client=get_client(),
method='put_object',
cannedACL='private',
)

@pytest.mark.cors
def test_cors_presigned_put_object_tenant():
_test_cors_options_presigned_method(
client=get_tenant_client(),
method='put_object',
)

@pytest.mark.cors
def test_cors_presigned_put_object_tenant_with_acl():
_test_cors_options_presigned_method(
client=get_tenant_client(),
Expand Down