_add_custom_headers(headers=headers, remove=remove)
return bucket.new_key('foo')
-def tag(*tags):
- def wrap(func):
- for tag in tags:
- setattr(func, tag, True)
- return func
- return wrap
-
#
# common tests
#
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_create_bad_contentlength_none():
key = _setup_bad_object(remove=('Content-Length',))
assert e.error_code == 'MissingContentLength'
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_rgw
def test_object_create_bad_contentlength_mismatch_above():
content = 'bar'
assert e.error_code == 'RequestTimeout'
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_create_bad_authorization_empty():
key = _setup_bad_object({'Authorization': ''})
assert e.reason == 'Forbidden'
assert e.error_code == 'AccessDenied'
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_create_date_and_amz_date():
date = formatdate(usegmt=True)
key = _setup_bad_object({'Date': date, 'X-Amz-Date': date})
key.set_contents_from_string('bar')
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_create_amz_date_and_no_date():
date = formatdate(usegmt=True)
# the teardown is really messed up here. check it out
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_create_bad_authorization_none():
key = _setup_bad_object(remove=('Authorization',))
assert e.error_code == 'AccessDenied'
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_bucket_create_contentlength_none():
_add_custom_headers(remove=('Content-Length',))
get_new_bucket()
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_object_acl_create_contentlength_none():
bucket = get_new_bucket()
)
return TargetConnection(targets.main.default.conf, conn)
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_contentlength_empty():
conn = _create_new_connection()
assert e.reason.lower() == 'bad request' # some proxies vary the case
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_bucket_create_bad_contentlength_none():
_add_custom_headers(remove=('Content-Length',))
bucket = get_new_bucket()
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_bucket_create_bad_authorization_empty():
_add_custom_headers({'Authorization': ''})
# the teardown is really messed up here. check it out
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_dbstore
def test_bucket_create_bad_authorization_none():
_add_custom_headers(remove=('Authorization',))
# AWS2 specific tests
#
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
@pytest.mark.fails_on_dbstore
def test_object_create_bad_contentlength_mismatch_below_aws2():
check_aws2_support()
assert e.error_code == 'BadDigest'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
@pytest.mark.fails_on_dbstore
def test_object_create_bad_authorization_incorrect_aws2():
check_aws2_support()
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch', 'InvalidAccessKeyId')
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
@pytest.mark.fails_on_dbstore
def test_object_create_bad_authorization_invalid_aws2():
check_aws2_support()
assert e.reason.lower() == 'bad request' # some proxies vary the case
assert e.error_code == 'InvalidArgument'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
@pytest.mark.fails_on_dbstore
def test_object_create_bad_date_none_aws2():
check_aws2_support()
assert e.error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_authorization_invalid_aws2():
check_aws2_support()
_add_custom_headers({'Authorization': 'AWS HAHAHA'})
assert e.reason.lower() == 'bad request' # some proxies vary the case
assert e.error_code == 'InvalidArgument'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
@pytest.mark.fails_on_dbstore
def test_bucket_create_bad_date_none_aws2():
check_aws2_support()
pytest.skip('sigv2 tests disabled by S3_USE_SIGV4')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_md5_invalid_garbage_aws4():
check_aws4_support()
key = _setup_bad_object({'Content-MD5':'AWS4 HAHAHA'})
assert e.error_code == 'InvalidDigest'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_contentlength_mismatch_below_aws4():
check_aws4_support()
content = 'bar'
assert e.error_code == 'XAmzContentSHA256Mismatch'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_authorization_incorrect_aws4():
check_aws4_support()
key = _setup_bad_object({'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAIGR7ZNNBHC5BKSUB/20150930/us-east-1/s3/aws4_request,SignedHeaders=host;user-agent,Signature=FWeDfwojDSdS2Ztmpfeubhd9isU='})
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch', 'InvalidAccessKeyId')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_authorization_invalid_aws4():
check_aws4_support()
key = _setup_bad_object({'Authorization': 'AWS4-HMAC-SHA256 Credential=HAHAHA'})
assert e.error_code in ('AuthorizationHeaderMalformed', 'InvalidArgument')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_ua_empty_aws4():
check_aws4_support()
key = _setup_bad_object({'User-Agent': ''})
assert e.error_code == 'SignatureDoesNotMatch'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_ua_none_aws4():
check_aws4_support()
key = _setup_bad_object(remove=('User-Agent',))
assert e.error_code == 'SignatureDoesNotMatch'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_invalid_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': 'Bad Date'})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_invalid_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': 'Bad Date'})
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_empty_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': ''})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_empty_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': ''})
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_none_aws4():
check_aws4_support()
key = _setup_bad_object(remove=('Date',))
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_none_aws4():
check_aws4_support()
key = _setup_bad_object(remove=('X-Amz-Date',))
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_before_today_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': 'Tue, 07 Jul 2010 21:53:04 GMT'})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_before_today_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': '20100707T215304Z'})
assert e.error_code in ('RequestTimeTooSkewed', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_after_today_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': 'Tue, 07 Jul 2030 21:53:04 GMT'})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_after_today_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': '20300707T215304Z'})
assert e.error_code in ('RequestTimeTooSkewed', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_before_epoch_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': 'Tue, 07 Jul 1950 21:53:04 GMT'})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_before_epoch_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': '19500707T215304Z'})
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_date_after_end_aws4():
check_aws4_support()
key = _setup_bad_object({'Date': 'Tue, 07 Jul 9999 21:53:04 GMT'})
key.set_contents_from_string('bar')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_bad_amz_date_after_end_aws4():
check_aws4_support()
key = _setup_bad_object({'X-Amz-Date': '99990707T215304Z'})
assert e.error_code in ('RequestTimeTooSkewed', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_missing_signed_custom_header_aws4():
check_aws4_support()
method='PUT'
assert res.reason == 'Forbidden'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_object_create_missing_signed_header_aws4():
check_aws4_support()
method='PUT'
assert res.reason == 'Forbidden'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_authorization_invalid_aws4():
check_aws4_support()
_add_custom_headers({'Authorization': 'AWS4 HAHAHA'})
assert e.error_code == 'InvalidArgument'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_ua_empty_aws4():
check_aws4_support()
_add_custom_headers({'User-Agent': ''})
assert e.reason == 'Forbidden'
assert e.error_code == 'SignatureDoesNotMatch'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_ua_none_aws4():
check_aws4_support()
_add_custom_headers(remove=('User-Agent',))
assert e.error_code == 'SignatureDoesNotMatch'
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_invalid_aws4():
check_aws4_support()
_add_custom_headers({'Date': 'Bad Date'})
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_invalid_aws4():
check_aws4_support()
_add_custom_headers({'X-Amz-Date': 'Bad Date'})
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_empty_aws4():
check_aws4_support()
_add_custom_headers({'Date': ''})
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_empty_aws4():
check_aws4_support()
_add_custom_headers({'X-Amz-Date': ''})
assert e.reason == 'Forbidden'
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_none_aws4():
check_aws4_support()
_add_custom_headers(remove=('Date',))
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_none_aws4():
check_aws4_support()
_add_custom_headers(remove=('X-Amz-Date',))
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_before_today_aws4():
check_aws4_support()
_add_custom_headers({'Date': 'Tue, 07 Jul 2010 21:53:04 GMT'})
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_before_today_aws4():
check_aws4_support()
_add_custom_headers({'X-Amz-Date': '20100707T215304Z'})
assert e.error_code in ('RequestTimeTooSkewed', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_after_today_aws4():
check_aws4_support()
_add_custom_headers({'Date': 'Tue, 07 Jul 2030 21:53:04 GMT'})
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_after_today_aws4():
check_aws4_support()
_add_custom_headers({'X-Amz-Date': '20300707T215304Z'})
assert e.error_code in ('RequestTimeTooSkewed', 'SignatureDoesNotMatch')
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_date_before_epoch_aws4():
check_aws4_support()
_add_custom_headers({'Date': 'Tue, 07 Jul 1950 21:53:04 GMT'})
get_new_bucket()
-@tag('auth_aws4')
+@pytest.mark.auth_aws4
def test_bucket_create_bad_amz_date_before_epoch_aws4():
check_aws4_support()
_add_custom_headers({'X-Amz-Date': '19500707T215304Z'})
return e
-def tag(*tags):
- def wrap(func):
- for tag in tags:
- setattr(func, tag, True)
- return func
- return wrap
-
#
# common tests
#
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_md5_invalid_short():
e = _add_header_create_bad_object({'Content-MD5':'YWJyYWNhZGFicmE='})
status, error_code = _get_status_and_error_code(e.response)
assert status == 400
assert error_code == 'InvalidDigest'
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_md5_bad():
e = _add_header_create_bad_object({'Content-MD5':'rL0Y20xC+Fzt72VPzMSk2A=='})
status, error_code = _get_status_and_error_code(e.response)
assert status == 400
assert error_code == 'BadDigest'
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_md5_empty():
e = _add_header_create_bad_object({'Content-MD5':''})
status, error_code = _get_status_and_error_code(e.response)
assert status == 400
assert error_code == 'InvalidDigest'
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_md5_none():
bucket_name, key_name = _remove_header_create_object('Content-MD5')
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_expect_mismatch():
bucket_name, key_name = _add_header_create_object({'Expect': 200})
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_expect_empty():
bucket_name, key_name = _add_header_create_object({'Expect': ''})
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_expect_none():
bucket_name, key_name = _remove_header_create_object('Expect')
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the content-length header
@pytest.mark.fails_on_rgw
def test_object_create_bad_contentlength_empty():
status, error_code = _get_status_and_error_code(e.response)
assert status == 400
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_mod_proxy_fcgi
def test_object_create_bad_contentlength_negative():
client = get_client()
status = _get_status(e.response)
assert status == 400
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the content-length header
@pytest.mark.fails_on_rgw
def test_object_create_bad_contentlength_none():
assert status == 411
assert error_code == 'MissingContentLength'
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_contenttype_invalid():
bucket_name, key_name = _add_header_create_object({'Content-Type': 'text/plain'})
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_contenttype_empty():
client = get_client()
key_name = 'foo'
bucket_name = get_new_bucket()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar', ContentType='')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_object_create_bad_contenttype_none():
bucket_name = get_new_bucket()
key_name = 'foo'
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the authorization header
@pytest.mark.fails_on_rgw
def test_object_create_bad_authorization_empty():
status, error_code = _get_status_and_error_code(e.response)
assert status == 403
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to pass both the 'Date' and 'X-Amz-Date' header during signing and not 'X-Amz-Date' before
@pytest.mark.fails_on_rgw
def test_object_create_date_and_amz_date():
client = get_client()
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to pass both the 'Date' and 'X-Amz-Date' header during signing and not 'X-Amz-Date' before
@pytest.mark.fails_on_rgw
def test_object_create_amz_date_and_no_date():
client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
# the teardown is really messed up here. check it out
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the authorization header
@pytest.mark.fails_on_rgw
def test_object_create_bad_authorization_none():
status, error_code = _get_status_and_error_code(e.response)
assert status == 403
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the content-length header
@pytest.mark.fails_on_rgw
def test_bucket_create_contentlength_none():
remove = 'Content-Length'
_remove_header_create_bucket(remove)
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the content-length header
@pytest.mark.fails_on_rgw
def test_object_acl_create_contentlength_none():
client.meta.events.register('before-call.s3.PutObjectAcl', remove_header)
client.put_object_acl(Bucket=bucket_name, Key='foo', ACL='public-read')
-@tag('auth_common')
+@pytest.mark.auth_common
def test_bucket_put_bad_canned_acl():
bucket_name = get_new_bucket()
client = get_client()
status = _get_status(e.response)
assert status == 400
-@tag('auth_common')
+@pytest.mark.auth_common
def test_bucket_create_bad_expect_mismatch():
bucket_name = get_new_bucket_name()
client = get_client()
client.meta.events.register('before-call.s3.CreateBucket', add_headers)
client.create_bucket(Bucket=bucket_name)
-@tag('auth_common')
+@pytest.mark.auth_common
def test_bucket_create_bad_expect_empty():
headers = {'Expect': ''}
_add_header_create_bucket(headers)
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: The request isn't even making it to the RGW past the frontend
# This test had 'fails_on_rgw' before the move to boto3
@pytest.mark.fails_on_rgw
status, error_code = _get_status_and_error_code(e.response)
assert status == 400
-@tag('auth_common')
+@pytest.mark.auth_common
@pytest.mark.fails_on_mod_proxy_fcgi
def test_bucket_create_bad_contentlength_negative():
headers = {'Content-Length': '-1'}
status = _get_status(e.response)
assert status == 400
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the content-length header
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_contentlength_none():
remove = 'Content-Length'
_remove_header_create_bucket(remove)
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to manipulate the authorization header
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_authorization_empty():
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_common')
+@pytest.mark.auth_common
# TODO: remove 'fails_on_rgw' and once we have learned how to manipulate the authorization header
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_authorization_none():
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_md5_invalid_garbage_aws2():
v2_client = get_v2_client()
headers = {'Content-MD5': 'AWS HAHAHA'}
assert status == 400
assert error_code == 'InvalidDigest'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to manipulate the Content-Length header
@pytest.mark.fails_on_rgw
def test_object_create_bad_contentlength_mismatch_below_aws2():
assert status == 400
assert error_code == 'BadDigest'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to manipulate the authorization header
@pytest.mark.fails_on_rgw
def test_object_create_bad_authorization_incorrect_aws2():
assert status == 403
assert error_code == 'InvalidDigest'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to manipulate the authorization header
@pytest.mark.fails_on_rgw
def test_object_create_bad_authorization_invalid_aws2():
assert status == 400
assert error_code == 'InvalidArgument'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_ua_empty_aws2():
v2_client = get_v2_client()
headers = {'User-Agent': ''}
bucket_name, key_name = _add_header_create_object(headers, v2_client)
v2_client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_ua_none_aws2():
v2_client = get_v2_client()
remove = 'User-Agent'
bucket_name, key_name = _remove_header_create_object(remove, v2_client)
v2_client.put_object(Bucket=bucket_name, Key=key_name, Body='bar')
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_date_invalid_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Bad Date'}
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_date_empty_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': ''}
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the date header
@pytest.mark.fails_on_rgw
def test_object_create_bad_date_none_aws2():
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_date_before_today_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 2010 21:53:04 GMT'}
assert status == 403
assert error_code == 'RequestTimeTooSkewed'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_date_before_epoch_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 1950 21:53:04 GMT'}
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_object_create_bad_date_after_end_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 9999 21:53:04 GMT'}
assert status == 403
assert error_code == 'RequestTimeTooSkewed'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the date header
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_authorization_invalid_aws2():
assert status == 400
assert error_code == 'InvalidArgument'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_ua_empty_aws2():
v2_client = get_v2_client()
headers = {'User-Agent': ''}
_add_header_create_bucket(headers, v2_client)
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_ua_none_aws2():
v2_client = get_v2_client()
remove = 'User-Agent'
_remove_header_create_bucket(remove, v2_client)
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_date_invalid_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Bad Date'}
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_date_empty_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': ''}
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
# TODO: remove 'fails_on_rgw' and once we have learned how to remove the date header
@pytest.mark.fails_on_rgw
def test_bucket_create_bad_date_none_aws2():
assert status == 403
assert error_code == 'AccessDenied'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_date_before_today_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 2010 21:53:04 GMT'}
assert status == 403
assert error_code == 'RequestTimeTooSkewed'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_date_after_today_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 2030 21:53:04 GMT'}
assert status == 403
assert error_code == 'RequestTimeTooSkewed'
-@tag('auth_aws2')
+@pytest.mark.auth_aws2
def test_bucket_create_bad_date_before_epoch_aws2():
v2_client = get_v2_client()
headers = {'x-amz-date': 'Tue, 07 Jul 1950 21:53:04 GMT'}