@attr(resource='bucket')
@attr(method='put')
@attr(operation='re-create')
- @attr(assertion='idempotent success')
def test_bucket_create_exists():
+ # aws-s3 default region allows recreation of buckets
+ # but all other regions fail with BucketAlreadyOwnedByYou.
bucket = get_new_bucket(targets.main.default)
- # REST idempotency means this should be a nop
- get_new_bucket(targets.main.default, bucket.name)
+ try:
+ get_new_bucket(targets.main.default, bucket.name)
+ except boto.exception.S3CreateError, e:
+ eq(e.status, 409)
+ eq(e.reason, 'Conflict')
+ eq(e.error_code, 'BucketAlreadyOwnedByYou')
+@attr(resource='bucket')
+@attr(method='get')
+@attr(operation='get location')
+def test_bucket_get_location():
+ bucket = get_new_bucket(targets.main.default)
+ actual_location = bucket.get_location()
+ expected_location = targets.main.default.conf.api_name
+ eq(actual_location, expected_location)
+
+
@attr(resource='bucket')
@attr(method='put')
@attr(operation='re-create by non-owner')