forked from TrueCloudLab/s3-tests
RGW test-case annotation for inventory.
Annotated S3 functional and error-detection test cases with resource/method/operation/assertion properties to enable automatic test case inventory generation. Signed-off-by: Mark Kampe <mark.kampe@dreamhost.com>
This commit is contained in:
parent
d69a33cc35
commit
a268bcfbef
2 changed files with 1048 additions and 60 deletions
|
@ -43,6 +43,8 @@ boto_type = None
|
|||
# necessary. We later determine in setup what needs to be used.
|
||||
|
||||
def _update_headers(headers):
|
||||
""" update a set of headers with additions/removals
|
||||
"""
|
||||
global _custom_headers, _remove_headers
|
||||
|
||||
headers.update(_custom_headers)
|
||||
|
@ -59,6 +61,8 @@ def _update_headers(headers):
|
|||
# headers modified or created in the authentication step.
|
||||
|
||||
class HeaderS3Connection(S3Connection):
|
||||
""" establish an authenticated connection w/customized headers
|
||||
"""
|
||||
def fill_in_auth(self, http_request, **kwargs):
|
||||
_update_headers(http_request.headers)
|
||||
S3Connection.fill_in_auth(self, http_request, **kwargs)
|
||||
|
@ -68,6 +72,8 @@ class HeaderS3Connection(S3Connection):
|
|||
|
||||
|
||||
def _our_authorize(self, connection, **kwargs):
|
||||
""" perform an authentication w/customized headers
|
||||
"""
|
||||
_update_headers(self.headers)
|
||||
_orig_authorize(self, connection, **kwargs)
|
||||
_update_headers(self.headers)
|
||||
|
@ -125,12 +131,16 @@ def teardown():
|
|||
|
||||
|
||||
def _clear_custom_headers():
|
||||
""" Eliminate any header customizations
|
||||
"""
|
||||
global _custom_headers, _remove_headers
|
||||
_custom_headers = {}
|
||||
_remove_headers = []
|
||||
|
||||
|
||||
def _add_custom_headers(headers=None, remove=None):
|
||||
""" Define header customizations (additions, replacements, removals)
|
||||
"""
|
||||
global _custom_headers, _remove_headers
|
||||
if not _custom_headers:
|
||||
_custom_headers = {}
|
||||
|
@ -142,12 +152,18 @@ def _add_custom_headers(headers=None, remove=None):
|
|||
|
||||
|
||||
def _setup_bad_object(headers=None, remove=None):
|
||||
""" Create a new bucket, add an object w/header customizations
|
||||
"""
|
||||
bucket = get_new_bucket()
|
||||
|
||||
_add_custom_headers(headers=headers, remove=remove)
|
||||
return bucket.new_key('foo')
|
||||
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/invalid MD5')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_md5_invalid():
|
||||
key = _setup_bad_object({'Content-MD5':'AWS HAHAHA'})
|
||||
|
@ -158,6 +174,10 @@ def test_object_create_bad_md5_invalid():
|
|||
eq(e.error_code, 'InvalidDigest')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/incorrect MD5')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_md5_wrong():
|
||||
key = _setup_bad_object({'Content-MD5':'YWJyYWNhZGFicmE='})
|
||||
|
@ -168,6 +188,10 @@ def test_object_create_bad_md5_wrong():
|
|||
eq(e.error_code, 'InvalidDigest')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty MD5')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_md5_empty():
|
||||
key = _setup_bad_object({'Content-MD5': ''})
|
||||
|
@ -178,6 +202,10 @@ def test_object_create_bad_md5_empty():
|
|||
eq(e.error_code, 'InvalidDigest')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphics in MD5')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_md5_unreadable():
|
||||
key = _setup_bad_object({'Content-MD5': '\x07'})
|
||||
|
@ -188,6 +216,10 @@ def test_object_create_bad_md5_unreadable():
|
|||
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no MD5 header')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_md5_none():
|
||||
key = _setup_bad_object(remove=('Content-MD5',))
|
||||
|
@ -196,6 +228,10 @@ def test_object_create_bad_md5_none():
|
|||
|
||||
# strangely, amazon doesn't report an error with a non-expect 100 also, our
|
||||
# error comes back as html, and not xml as I normally expect
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/Expect 200')
|
||||
@attr(assertion='garbage, but S3 succeeds!')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
def test_object_create_bad_expect_mismatch():
|
||||
|
@ -205,12 +241,20 @@ def test_object_create_bad_expect_mismatch():
|
|||
|
||||
# this is a really long test, and I don't know if it's valid...
|
||||
# again, accepts this with no troubles
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty expect')
|
||||
@attr(assertion='succeeds ... should it?')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_expect_empty():
|
||||
key = _setup_bad_object({'Expect': ''})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no expect')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_expect_none():
|
||||
key = _setup_bad_object(remove=('Expect',))
|
||||
|
@ -218,6 +262,10 @@ def test_object_create_bad_expect_none():
|
|||
|
||||
|
||||
# this is a really long test..
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic expect')
|
||||
@attr(assertion='garbage, but S3 succeeds!')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
def test_object_create_bad_expect_unreadable():
|
||||
|
@ -225,6 +273,10 @@ def test_object_create_bad_expect_unreadable():
|
|||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
@attr('fails_on_rgw')
|
||||
|
@ -237,6 +289,10 @@ def test_object_create_bad_contentlength_empty():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/negative content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
def test_object_create_bad_contentlength_negative():
|
||||
|
@ -248,6 +304,10 @@ def test_object_create_bad_contentlength_negative():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no content length')
|
||||
@attr(assertion='fails 411')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contentlength_none():
|
||||
key = _setup_bad_object(remove=('Content-Length',))
|
||||
|
@ -257,7 +317,10 @@ def test_object_create_bad_contentlength_none():
|
|||
eq(e.reason, 'Length Required')
|
||||
eq(e.error_code,'MissingContentLength')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
def test_object_create_bad_contentlength_unreadable():
|
||||
|
@ -269,6 +332,10 @@ def test_object_create_bad_contentlength_unreadable():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/content length too long')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
def test_object_create_bad_contentlength_mismatch_above():
|
||||
|
@ -283,6 +350,10 @@ def test_object_create_bad_contentlength_mismatch_above():
|
|||
eq(e.error_code, 'RequestTimeout')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/content length too short')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contentlength_mismatch_below():
|
||||
content = 'bar'
|
||||
|
@ -296,24 +367,40 @@ def test_object_create_bad_contentlength_mismatch_below():
|
|||
eq(e.error_code, 'BadDigest')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/content type text/plain')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contenttype_invalid():
|
||||
key = _setup_bad_object({'Content-Type': 'text/plain'})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty content type')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contenttype_empty():
|
||||
key = _setup_bad_object({'Content-Type': ''})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no content type')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contenttype_none():
|
||||
key = _setup_bad_object(remove=('Content-Type',))
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic content type')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
@attr('fails_on_dho')
|
||||
|
@ -326,30 +413,30 @@ def test_object_create_bad_contenttype_unreadable():
|
|||
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
|
||||
|
||||
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_contenttype_none():
|
||||
key = _setup_bad_object(remove=('Content-Type',))
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_ua_invalid():
|
||||
key = _setup_bad_object({'User-Agent': ''})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_ua_empty():
|
||||
key = _setup_bad_object({'User-Agent': ''})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_ua_unreadable():
|
||||
key = _setup_bad_object({'User-Agent': '\x07'})
|
||||
key.set_contents_from_string('bar')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_ua_none():
|
||||
key = _setup_bad_object(remove=('User-Agent',))
|
||||
|
@ -357,6 +444,10 @@ def test_object_create_bad_ua_none():
|
|||
|
||||
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/invalid authorization')
|
||||
@attr(assertion='fails 400')
|
||||
def test_object_create_bad_authorization_invalid():
|
||||
key = _setup_bad_object({'Authorization': 'AWS HAHAHA'})
|
||||
|
||||
|
@ -367,6 +458,10 @@ def test_object_create_bad_authorization_invalid():
|
|||
|
||||
|
||||
# the teardown is really messed up here. check it out
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
@attr('fails_on_dho')
|
||||
|
@ -379,6 +474,10 @@ def test_object_create_bad_authorization_unreadable():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_authorization_empty():
|
||||
key = _setup_bad_object({'Authorization': ''})
|
||||
|
@ -390,6 +489,10 @@ def test_object_create_bad_authorization_empty():
|
|||
|
||||
|
||||
# the teardown is really messed up here. check it out
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_authorization_none():
|
||||
key = _setup_bad_object(remove=('Authorization',))
|
||||
|
@ -400,6 +503,10 @@ def test_object_create_bad_authorization_none():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/incorrect authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_authorization_incorrect():
|
||||
key = _setup_bad_object({'Authorization': 'AWS AKIAIGR7ZNNBHC5BKSUA:FWeDfwojDSdS2Ztmpfeubhd9isU='})
|
||||
|
@ -410,6 +517,10 @@ def test_object_create_bad_authorization_incorrect():
|
|||
assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/invalid date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_invalid():
|
||||
key = _setup_bad_object({'Date': 'Bad Date'})
|
||||
|
@ -420,6 +531,10 @@ def test_object_create_bad_date_invalid():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_empty():
|
||||
key = _setup_bad_object({'Date': ''})
|
||||
|
@ -430,6 +545,10 @@ def test_object_create_bad_date_empty():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_unreadable():
|
||||
key = _setup_bad_object({'Date': '\x07'})
|
||||
|
@ -440,6 +559,10 @@ def test_object_create_bad_date_unreadable():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_none():
|
||||
key = _setup_bad_object(remove=('Date',))
|
||||
|
@ -450,6 +573,10 @@ def test_object_create_bad_date_none():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date in past')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_before_today():
|
||||
key = _setup_bad_object({'Date': 'Tue, 07 Jul 2010 21:53:04 GMT'})
|
||||
|
@ -460,6 +587,10 @@ def test_object_create_bad_date_before_today():
|
|||
eq(e.error_code, 'RequestTimeTooSkewed')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date in future')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_after_today():
|
||||
key = _setup_bad_object({'Date': 'Tue, 07 Jul 2030 21:53:04 GMT'})
|
||||
|
@ -470,6 +601,10 @@ def test_object_create_bad_date_after_today():
|
|||
eq(e.error_code, 'RequestTimeTooSkewed')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date before epoch')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_before_epoch():
|
||||
key = _setup_bad_object({'Date': 'Tue, 07 Jul 1950 21:53:04 GMT'})
|
||||
|
@ -480,6 +615,10 @@ def test_object_create_bad_date_before_epoch():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date after 9999')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_create_bad_date_after_end():
|
||||
key = _setup_bad_object({'Date': 'Tue, 07 Jul 9999 21:53:04 GMT'})
|
||||
|
@ -490,12 +629,19 @@ def test_object_create_bad_date_after_end():
|
|||
eq(e.error_code, 'RequestTimeTooSkewed')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no content length')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_contentlength_none():
|
||||
_add_custom_headers(remove=('Content-Length',))
|
||||
get_new_bucket()
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='acls')
|
||||
@attr(operation='set w/no content length')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_object_acl_create_contentlength_none():
|
||||
bucket = get_new_bucket()
|
||||
|
@ -505,6 +651,10 @@ def test_object_acl_create_contentlength_none():
|
|||
_add_custom_headers(remove=('Content-Length',))
|
||||
key.set_acl('public-read')
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='acls')
|
||||
@attr(operation='set w/invalid permission')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_put_bad_canned_acl():
|
||||
bucket = get_new_bucket()
|
||||
|
@ -517,6 +667,10 @@ def test_bucket_put_bad_canned_acl():
|
|||
|
||||
# strangely, amazon doesn't report an error with a non-expect 100 also, our
|
||||
# error comes back as html, and not xml as I normally expect
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/expect 200')
|
||||
@attr(assertion='garbage, but S3 succeeds!')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
def test_bucket_create_bad_expect_mismatch():
|
||||
|
@ -526,11 +680,19 @@ def test_bucket_create_bad_expect_mismatch():
|
|||
|
||||
# this is a really long test, and I don't know if it's valid...
|
||||
# again, accepts this with no troubles
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/expect empty')
|
||||
@attr(assertion='garbage, but S3 succeeds!')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_expect_empty():
|
||||
_add_custom_headers({'Expect': ''})
|
||||
bucket = get_new_bucket()
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/expect nongraphic')
|
||||
@attr(assertion='garbage, but S3 succeeds!')
|
||||
# this is a really long test..
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
|
@ -553,6 +715,10 @@ def _create_new_connection():
|
|||
)
|
||||
return conn
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
@attr('fails_on_rgw')
|
||||
|
@ -566,6 +732,10 @@ def test_bucket_create_bad_contentlength_empty():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/negative content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
def test_bucket_create_bad_contentlength_negative():
|
||||
|
@ -576,12 +746,20 @@ def test_bucket_create_bad_contentlength_negative():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no content length')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_contentlength_none():
|
||||
_add_custom_headers(remove=('Content-Length',))
|
||||
bucket = get_new_bucket()
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic content length')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_dho')
|
||||
def test_bucket_create_bad_contentlength_unreadable():
|
||||
|
@ -593,24 +771,40 @@ def test_bucket_create_bad_contentlength_unreadable():
|
|||
eq(e.error_code, None)
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_ua_empty():
|
||||
_add_custom_headers({'User-Agent': ''})
|
||||
bucket = get_new_bucket()
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_ua_unreadable():
|
||||
_add_custom_headers({'User-Agent': '\x07'})
|
||||
bucket = get_new_bucket()
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no user agent')
|
||||
@attr(assertion='succeeds')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_ua_none():
|
||||
_add_custom_headers(remove=('User-Agent',))
|
||||
bucket = get_new_bucket()
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/invalid authorization')
|
||||
@attr(assertion='fails 400')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_authorization_invalid():
|
||||
_add_custom_headers({'Authorization': 'AWS HAHAHA'})
|
||||
|
@ -622,6 +816,10 @@ def test_bucket_create_bad_authorization_invalid():
|
|||
|
||||
|
||||
# the teardown is really messed up here. check it out
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
@attr('fails_on_rgw')
|
||||
@attr('fails_on_dho')
|
||||
|
@ -634,6 +832,10 @@ def test_bucket_create_bad_authorization_unreadable():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_authorization_empty():
|
||||
_add_custom_headers({'Authorization': ''})
|
||||
|
@ -645,6 +847,10 @@ def test_bucket_create_bad_authorization_empty():
|
|||
|
||||
|
||||
# the teardown is really messed up here. check it out
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no authorization')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_authorization_none():
|
||||
_add_custom_headers(remove=('Authorization',))
|
||||
|
@ -654,6 +860,10 @@ def test_bucket_create_bad_authorization_none():
|
|||
eq(e.reason, 'Forbidden')
|
||||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/invalid date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_invalid():
|
||||
_add_custom_headers({'Date': 'Bad Date'})
|
||||
|
@ -664,6 +874,10 @@ def test_bucket_create_bad_date_invalid():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/empty date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_empty():
|
||||
_add_custom_headers({'Date': ''})
|
||||
|
@ -674,6 +888,10 @@ def test_bucket_create_bad_date_empty():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/non-graphic date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_unreadable():
|
||||
_add_custom_headers({'Date': '\x07'})
|
||||
|
@ -684,9 +902,13 @@ def test_bucket_create_bad_date_unreadable():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/no date')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_none():
|
||||
_add_custom_headers({'Date': '\x07'})
|
||||
_add_custom_headers(remove=('Date',))
|
||||
e = assert_raises(boto.exception.S3ResponseError, get_new_bucket)
|
||||
|
||||
eq(e.status, 403)
|
||||
|
@ -694,6 +916,10 @@ def test_bucket_create_bad_date_none():
|
|||
eq(e.error_code, 'AccessDenied')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date in past')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_before_today():
|
||||
_add_custom_headers({'Date': 'Tue, 07 Jul 2010 21:53:04 GMT'})
|
||||
|
@ -704,6 +930,10 @@ def test_bucket_create_bad_date_before_today():
|
|||
eq(e.error_code, 'RequestTimeTooSkewed')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date in future')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_after_today():
|
||||
_add_custom_headers({'Date': 'Tue, 07 Jul 2030 21:53:04 GMT'})
|
||||
|
@ -714,6 +944,10 @@ def test_bucket_create_bad_date_after_today():
|
|||
eq(e.error_code, 'RequestTimeTooSkewed')
|
||||
|
||||
|
||||
@attr(resource='bucket')
|
||||
@attr(method='put')
|
||||
@attr(operation='create w/date before epoch')
|
||||
@attr(assertion='fails 403')
|
||||
@nose.with_setup(teardown=_clear_custom_headers)
|
||||
def test_bucket_create_bad_date_before_epoch():
|
||||
_add_custom_headers({'Date': 'Tue, 07 Jul 1950 21:53:04 GMT'})
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue