mirror of
https://github.com/ceph/s3-tests.git
synced 2025-01-11 01:20:39 +00:00
s3-tests: add test_object_giveaway
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
parent
75136b58b8
commit
e8a5077913
1 changed files with 15 additions and 0 deletions
15
test_s3.py
15
test_s3.py
|
@ -739,3 +739,18 @@ def test_object_set_valid_acl():
|
|||
key = bucket.new_key('foo')
|
||||
key.set_contents_from_string('bar')
|
||||
key.set_xml_acl(XML_1)
|
||||
|
||||
def test_object_giveaway():
|
||||
obj = _setup_access(bucket_acl='public-read', object_acl='public-read-write')
|
||||
CORRECT_ACL = '<?xml version="1.0" encoding="UTF-8"?><AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>' + config.main.user_id + '</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>' + config.main.user_id + '</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>'
|
||||
WRONG_ACL = '<?xml version="1.0" encoding="UTF-8"?><AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>' + config.alt.user_id + '</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>' + config.alt.user_id + '</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>'
|
||||
#try:
|
||||
bucket = get_new_bucket()
|
||||
key = bucket.new_key('foo')
|
||||
key.set_contents_from_string('bar')
|
||||
key.set_xml_acl(CORRECT_ACL)
|
||||
try:
|
||||
key.set_xml_acl(WRONG_ACL)
|
||||
raise RuntimeError("S3 implementation allowed us to give away an object!")
|
||||
except boto.exception.S3ResponseError, e:
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue