mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-24 19:30:38 +00:00
test two cases in copying object to itself
- should fail when not trying to change metadata - should succeed when changing metadata; also verify metadata Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
parent
769edeb53b
commit
304e3422e2
1 changed files with 29 additions and 0 deletions
|
@ -2745,6 +2745,35 @@ def test_object_copy_same_bucket():
|
|||
key2 = bucket.get_key('bar321foo')
|
||||
eq(key2.get_contents_as_string(), 'foo')
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='copy object to itself')
|
||||
@attr(assertion='fails')
|
||||
def test_object_copy_to_itself():
|
||||
bucket = get_new_bucket()
|
||||
key = bucket.new_key('foo123bar')
|
||||
key.set_contents_from_string('foo')
|
||||
e = assert_raises(boto.exception.S3ResponseError, key.copy, bucket, 'foo123bar')
|
||||
eq(e.status, 400)
|
||||
eq(e.reason, 'Bad Request')
|
||||
eq(e.error_code, 'InvalidRequest')
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='modify object metadata by copying')
|
||||
@attr(assertion='fails')
|
||||
def test_object_copy_to_itself_with_metadata():
|
||||
bucket = get_new_bucket()
|
||||
key = bucket.new_key('foo123bar')
|
||||
key.set_contents_from_string('foo')
|
||||
key.copy(bucket, 'foo123bar', {'foo': 'bar'})
|
||||
key.close()
|
||||
|
||||
bucket2 = s3.main.get_bucket(bucket.name)
|
||||
key2 = bucket2.get_key('foo123bar')
|
||||
md = key2.get_metadata('foo')
|
||||
eq(md, 'bar')
|
||||
|
||||
@attr(resource='object')
|
||||
@attr(method='put')
|
||||
@attr(operation='copy object from different bucket')
|
||||
|
|
Loading…
Reference in a new issue