Index: tests/s3/mock_storage_service.py |
diff --git a/tests/s3/mock_storage_service.py b/tests/s3/mock_storage_service.py |
index 0f3ea7b8482ab85fcc38411e22ba75d95222ef43..aa28b595826cfacf9a0221bc439eab6a846cc02b 100644 |
--- a/tests/s3/mock_storage_service.py |
+++ b/tests/s3/mock_storage_service.py |
@@ -125,6 +125,8 @@ class MockBucket(object): |
self.name = name |
self.keys = {} |
self.acls = {name: MockAcl()} |
+ # default object ACLs are one per bucket and not supported for keys |
+ self.def_acl = MockAcl() |
self.subresources = {} |
self.connection = connection |
self.logging = False |
@@ -153,6 +155,11 @@ class MockBucket(object): |
# Return ACL for the bucket. |
return self.acls[self.name] |
+ def get_def_acl(self, key_name=NOT_IMPL, headers=NOT_IMPL, |
+ version_id=NOT_IMPL): |
+ # Return default ACL for the bucket. |
+ return self.def_acl |
+ |
def get_subresource(self, subresource, key_name=NOT_IMPL, headers=NOT_IMPL, |
version_id=NOT_IMPL): |
if subresource in self.subresources: |
@@ -205,6 +212,13 @@ class MockBucket(object): |
# Set ACL for the bucket. |
self.acls[self.name] = acl_or_str |
+ def set_def_acl(self, acl_or_str, key_name=NOT_IMPL, headers=NOT_IMPL, |
+ version_id=NOT_IMPL): |
+ # We only handle setting ACL XML here; if you pass a canned ACL |
+ # the get_acl call will just return that string name. |
+ # Set default ACL for the bucket. |
+ self.def_acl = acl_or_str |
+ |
def set_subresource(self, subresource, value, key_name=NOT_IMPL, |
headers=NOT_IMPL, version_id=NOT_IMPL): |
self.subresources[subresource] = value |
@@ -311,6 +325,10 @@ class MockBucketStorageUri(object): |
def get_acl(self, validate=NOT_IMPL, headers=NOT_IMPL, version_id=NOT_IMPL): |
return self.get_bucket().get_acl(self.object_name) |
+ def get_def_acl(self, validate=NOT_IMPL, headers=NOT_IMPL, |
+ version_id=NOT_IMPL): |
+ return self.get_bucket().get_def_acl(self.object_name) |
+ |
def get_subresource(self, subresource, validate=NOT_IMPL, headers=NOT_IMPL, |
version_id=NOT_IMPL): |
return self.get_bucket().get_subresource(subresource, self.object_name) |
@@ -348,6 +366,10 @@ class MockBucketStorageUri(object): |
headers=NOT_IMPL, version_id=NOT_IMPL): |
self.get_bucket().set_acl(acl_or_str, key_name) |
+ def set_def_acl(self, acl_or_str, key_name=NOT_IMPL, validate=NOT_IMPL, |
+ headers=NOT_IMPL, version_id=NOT_IMPL): |
+ self.get_bucket().set_def_acl(acl_or_str) |
+ |
def set_subresource(self, subresource, value, validate=NOT_IMPL, |
headers=NOT_IMPL, version_id=NOT_IMPL): |
self.get_bucket().set_subresource(subresource, value, self.object_name) |