diff --git a/gcloud/storage/bucket.py b/gcloud/storage/bucket.py index 37691396db5e..585440782212 100644 --- a/gcloud/storage/bucket.py +++ b/gcloud/storage/bucket.py @@ -443,7 +443,9 @@ def save_acl(self, acl=None): if acl is None: return self - return self.patch_metadata({'acl': list(acl)}) + self.patch_metadata({'acl': list(acl)}) + self.reload_acl() + return self def clear_acl(self): """Remove all ACL rules from the bucket. diff --git a/gcloud/storage/key.py b/gcloud/storage/key.py index 2022ac5eccf1..722e3e393968 100644 --- a/gcloud/storage/key.py +++ b/gcloud/storage/key.py @@ -404,7 +404,9 @@ def save_acl(self, acl=None): if acl is None: return self - return self.patch_metadata({'acl': list(acl)}) + self.patch_metadata({'acl': list(acl)}) + self.reload_acl() + return self def clear_acl(self): """Remove all ACL rules from the key. diff --git a/gcloud/storage/test_bucket.py b/gcloud/storage/test_bucket.py index fa5f0e9e5b14..c7969c7cd0e2 100644 --- a/gcloud/storage/test_bucket.py +++ b/gcloud/storage/test_bucket.py @@ -532,8 +532,7 @@ def test_save_acl_existing_set_new_passed(self): bucket = self._makeOne(connection, NAME, metadata) bucket.reload_acl() self.assertTrue(bucket.save_acl(new_acl) is bucket) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 - #self.assertEqual(list(bucket.acl), new_acl) + self.assertEqual(list(bucket.acl), new_acl) kw = connection._requested self.assertEqual(len(kw), 1) self.assertEqual(kw[0]['method'], 'PATCH') @@ -550,8 +549,7 @@ def test_clear_acl(self): bucket = self._makeOne(connection, NAME, metadata) bucket.reload_acl() self.assertTrue(bucket.clear_acl() is bucket) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 - #self.assertEqual(list(bucket.acl), []) + self.assertEqual(list(bucket.acl), []) kw = connection._requested self.assertEqual(len(kw), 1) self.assertEqual(kw[0]['method'], 'PATCH') @@ -648,7 +646,7 @@ def test_save_default_object_acl_existing_set_new_passed(self): bucket = self._makeOne(connection, NAME, metadata) bucket.reload_default_object_acl() self.assertTrue(bucket.save_default_object_acl(new_acl) is bucket) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 + # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/139 #self.assertEqual(list(bucket.default_object_acl), new_acl) kw = connection._requested self.assertEqual(len(kw), 1) @@ -666,14 +664,12 @@ def test_clear_default_object_acl(self): bucket = self._makeOne(connection, NAME, metadata) bucket.reload_default_object_acl() self.assertTrue(bucket.clear_default_object_acl() is bucket) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 + # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/139 #self.assertEqual(list(bucket.default_object_acl), []) kw = connection._requested self.assertEqual(len(kw), 1) self.assertEqual(kw[0]['method'], 'PATCH') self.assertEqual(kw[0]['path'], '/b/%s' % NAME) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/139 - #self.assertEqual(list(bucket.default_object_acl), []) #self.assertEqual(kw[0]['data'], {'defaultObjectAcl': []}) self.assertEqual(kw[0]['query_params'], {'projection': 'full'}) diff --git a/gcloud/storage/test_key.py b/gcloud/storage/test_key.py index e261178bcbbd..28db03c400f3 100644 --- a/gcloud/storage/test_key.py +++ b/gcloud/storage/test_key.py @@ -509,8 +509,7 @@ def test_save_acl_existing_set_new_passed(self): key = self._makeOne(bucket, KEY, metadata) key.reload_acl() self.assertTrue(key.save_acl(new_acl) is key) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 - #self.assertEqual(list(bucket.acl), new_acl) + self.assertEqual(list(key.acl), new_acl) kw = connection._requested self.assertEqual(len(kw), 1) self.assertEqual(kw[0]['method'], 'PATCH') @@ -528,8 +527,7 @@ def test_clear_acl(self): key = self._makeOne(bucket, KEY, metadata) key.reload_acl() self.assertTrue(key.clear_acl() is key) - # See: https://github.com/GoogleCloudPlatform/gcloud-python/issues/138 - #self.assertEqual(list(key.acl), []) + self.assertEqual(list(key.acl), []) kw = connection._requested self.assertEqual(len(kw), 1) self.assertEqual(kw[0]['method'], 'PATCH')