Tag cors tests

This commit is contained in:
Andrew Gaul 2024-09-03 15:44:54 +02:00
parent e8db6c2c16
commit be6a1a658c
2 changed files with 11 additions and 0 deletions

View file

@ -9,6 +9,7 @@ markers =
bucket_encryption
checksum
cloud_transition
cors
encryption
fails_on_aws
fails_on_dbstore

View file

@ -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()
@ -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()
@ -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()
@ -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()
@ -6776,24 +6780,28 @@ 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(),
@ -6801,12 +6809,14 @@ def test_cors_presigned_put_object_with_acl():
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(),