mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 23:29:47 +00:00
s3tests: improve cors test to cover more functionality
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
parent
7bdf4b897a
commit
ef471ec2b9
1 changed files with 21 additions and 1 deletions
|
@ -4260,7 +4260,8 @@ def test_stress_bucket_acls_changes():
|
||||||
def test_set_cors():
|
def test_set_cors():
|
||||||
bucket = get_new_bucket()
|
bucket = get_new_bucket()
|
||||||
cfg = CORSConfiguration()
|
cfg = CORSConfiguration()
|
||||||
cfg.add_rule('GET', '*')
|
cfg.add_rule('GET', '*.get')
|
||||||
|
cfg.add_rule('PUT', '*.put')
|
||||||
|
|
||||||
e = assert_raises(boto.exception.S3ResponseError, bucket.get_cors)
|
e = assert_raises(boto.exception.S3ResponseError, bucket.get_cors)
|
||||||
eq(e.status, 404)
|
eq(e.status, 404)
|
||||||
|
@ -4268,6 +4269,25 @@ def test_set_cors():
|
||||||
bucket.set_cors(cfg)
|
bucket.set_cors(cfg)
|
||||||
new_cfg = bucket.get_cors()
|
new_cfg = bucket.get_cors()
|
||||||
|
|
||||||
|
eq(len(new_cfg), 2)
|
||||||
|
|
||||||
|
result = bunch.Bunch()
|
||||||
|
|
||||||
|
for c in new_cfg:
|
||||||
|
eq(len(c.allowed_method), 1)
|
||||||
|
eq(len(c.allowed_origin), 1)
|
||||||
|
result[c.allowed_method[0]] = c.allowed_origin[0]
|
||||||
|
|
||||||
|
|
||||||
|
eq(result['GET'], '*.get')
|
||||||
|
eq(result['PUT'], '*.put')
|
||||||
|
|
||||||
|
bucket.delete_cors()
|
||||||
|
|
||||||
|
e = assert_raises(boto.exception.S3ResponseError, bucket.get_cors)
|
||||||
|
eq(e.status, 404)
|
||||||
|
|
||||||
|
|
||||||
class FakeFile(object):
|
class FakeFile(object):
|
||||||
"""
|
"""
|
||||||
file that simulates seek, tell, and current character
|
file that simulates seek, tell, and current character
|
||||||
|
|
Loading…
Reference in a new issue