diff --git a/gcloud/storage/_helpers.py b/gcloud/storage/_helpers.py index d972079f06d5..8b340df9c1a6 100644 --- a/gcloud/storage/_helpers.py +++ b/gcloud/storage/_helpers.py @@ -25,7 +25,7 @@ class _PropertyMixin(object): """Abstract mixin for cloud storage classes with associated propertties. Non-abstract subclasses should implement: - - connection + - client - path :type name: string @@ -65,8 +65,8 @@ def reload(self, client=None): """Reload properties from Cloud Storage. :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` - :param client: Optional. The client to use. If not passed, falls back - to default connection. + :param client: the client to use. If not passed, falls back to the + ``client`` stored on the current object. """ client = self._require_client(client) # Pass only '?projection=noAcl' here because 'acl' and related @@ -111,8 +111,8 @@ def patch(self, client=None): Updates the ``_properties`` with the response from the backend. :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` - :param client: Optional. The client to use. If not passed, falls back - to default connection. + :param client: the client to use. If not passed, falls back to the + ``client`` stored on the current object. """ client = self._require_client(client) # Pass '?projection=full' here because 'PATCH' documented not diff --git a/gcloud/storage/acl.py b/gcloud/storage/acl.py index 46c228554b77..69914c5b937a 100644 --- a/gcloud/storage/acl.py +++ b/gcloud/storage/acl.py @@ -359,7 +359,7 @@ def _require_client(self, client): :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` :param client: the client to use. If not passed, falls back to the - ``client`` stored on the current object. + ``client`` stored on the current ACL. :rtype: :class:`gcloud.storage.client.Client` :returns: The client passed in or the currently bound client. @@ -373,7 +373,7 @@ def reload(self, client=None): :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back - to default connection. + to the ``client`` stored on the ACL's parent. """ path = self.reload_path client = self._require_client(client) @@ -394,7 +394,7 @@ def save(self, acl=None, client=None): :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back - to default connection. + to the ``client`` stored on the ACL's parent. """ if acl is None: acl = self @@ -425,7 +425,7 @@ def clear(self, client=None): :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back - to default connection. + to the ``client`` stored on the ACL's parent. """ self.save([], client=client) diff --git a/gcloud/storage/test__helpers.py b/gcloud/storage/test__helpers.py index 740cfd4e2e5b..e9bca19032d0 100644 --- a/gcloud/storage/test__helpers.py +++ b/gcloud/storage/test__helpers.py @@ -42,7 +42,7 @@ def test_client_is_abstract(self): mixin = self._makeOne() self.assertRaises(NotImplementedError, lambda: mixin.client) - def test_reload_w_explicit_connection(self): + def test_reload(self): connection = _Connection({'foo': 'Foo'}) client = _Client(connection) derived = self._derivedClass('/path')() @@ -70,7 +70,7 @@ def test__patch_property(self): derived._patch_property('foo', 'Foo') self.assertEqual(derived._properties, {'foo': 'Foo'}) - def test_patch_w_explicit_connection(self): + def test_patch(self): connection = _Connection({'foo': 'Foo'}) client = _Client(connection) derived = self._derivedClass('/path')() diff --git a/gcloud/storage/test_acl.py b/gcloud/storage/test_acl.py index 34785436fa80..08bf1aba8ea8 100644 --- a/gcloud/storage/test_acl.py +++ b/gcloud/storage/test_acl.py @@ -31,7 +31,7 @@ def test_ctor_default_identifier(self): self.assertEqual(entity.identifier, None) self.assertEqual(entity.get_roles(), set()) - def test_ctor_explicit_identifier(self): + def test_ctor_w_identifier(self): TYPE = 'type' ID = 'id' entity = self._makeOne(TYPE, ID) @@ -509,7 +509,7 @@ def test_get_entities_nonempty(self): entity = acl.entity(TYPE, ID) self.assertEqual(acl.get_entities(), [entity]) - def test_reload_missing_w_explicit_connection(self): + def test_reload_missing(self): # https://github.com/GoogleCloudPlatform/gcloud-python/issues/652 ROLE = 'role' connection = _Connection({}) @@ -525,7 +525,7 @@ def test_reload_missing_w_explicit_connection(self): self.assertEqual(kw[0]['method'], 'GET') self.assertEqual(kw[0]['path'], '/testing/acl') - def test_reload_empty_result_clears_local_w_explicit_connection(self): + def test_reload_empty_result_clears_local(self): ROLE = 'role' connection = _Connection({'items': []}) client = _Client(connection) @@ -541,7 +541,7 @@ def test_reload_empty_result_clears_local_w_explicit_connection(self): self.assertEqual(kw[0]['method'], 'GET') self.assertEqual(kw[0]['path'], '/testing/acl') - def test_reload_nonempty_result_w_explicit_connection(self): + def test_reload_nonempty_result(self): ROLE = 'role' connection = _Connection( {'items': [{'entity': 'allUsers', 'role': ROLE}]}) @@ -557,7 +557,7 @@ def test_reload_nonempty_result_w_explicit_connection(self): self.assertEqual(kw[0]['method'], 'GET') self.assertEqual(kw[0]['path'], '/testing/acl') - def test_save_none_set_none_passed_w_explicit_connection(self): + def test_save_none_set_none_passed(self): connection = _Connection() client = _Client(connection) acl = self._makeOne() @@ -566,7 +566,7 @@ def test_save_none_set_none_passed_w_explicit_connection(self): kw = connection._requested self.assertEqual(len(kw), 0) - def test_save_existing_missing_none_passed_w_explicit_connection(self): + def test_save_existing_missing_none_passed(self): connection = _Connection({}) client = _Client(connection) acl = self._makeOne() @@ -581,7 +581,7 @@ def test_save_existing_missing_none_passed_w_explicit_connection(self): self.assertEqual(kw[0]['data'], {'acl': []}) self.assertEqual(kw[0]['query_params'], {'projection': 'full'}) - def test_save_no_arg_w_explicit_connection(self): + def test_save_no_arg(self): ROLE = 'role' AFTER = [{'entity': 'allUsers', 'role': ROLE}] connection = _Connection({'acl': AFTER}) @@ -599,7 +599,7 @@ def test_save_no_arg_w_explicit_connection(self): self.assertEqual(kw[0]['data'], {'acl': AFTER}) self.assertEqual(kw[0]['query_params'], {'projection': 'full'}) - def test_save_w_arg_w_explicit_connection(self): + def test_save_w_arg(self): ROLE1 = 'role1' ROLE2 = 'role2' STICKY = {'entity': 'allUsers', 'role': ROLE2} @@ -621,7 +621,7 @@ def test_save_w_arg_w_explicit_connection(self): self.assertEqual(kw[0]['data'], {'acl': new_acl}) self.assertEqual(kw[0]['query_params'], {'projection': 'full'}) - def test_clear_w_explicit_connection(self): + def test_clear(self): ROLE1 = 'role1' ROLE2 = 'role2' STICKY = {'entity': 'allUsers', 'role': ROLE2} diff --git a/gcloud/storage/test_batch.py b/gcloud/storage/test_batch.py index b08cffab91d3..de62980431ac 100644 --- a/gcloud/storage/test_batch.py +++ b/gcloud/storage/test_batch.py @@ -75,7 +75,7 @@ def _getTargetClass(self): def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) - def test_ctor_w_explicit_connection(self): + def test_ctor(self): http = _HTTP() connection = _Connection(http=http) client = _Client(connection) diff --git a/gcloud/storage/test_blob.py b/gcloud/storage/test_blob.py index c85a62e4f94d..e4541ff2b38d 100644 --- a/gcloud/storage/test_blob.py +++ b/gcloud/storage/test_blob.py @@ -183,7 +183,7 @@ def test_generate_signed_url_w_slash_in_name(self): } self.assertEqual(SIGNER._signed, [(EXPECTED_ARGS, EXPECTED_KWARGS)]) - def test_generate_signed_url_w_explicit_method(self): + def test_generate_signed_url_w_method_arg(self): from gcloud._testing import _Monkey from gcloud.storage import blob as MUT @@ -674,7 +674,7 @@ def test_upload_from_string_w_text(self): self.assertEqual(headers['Content-Type'], 'text/plain') self.assertEqual(rq[0]['body'], ENCODED) - def test_make_public_w_explicit_connection(self): + def test_make_public(self): from gcloud.storage.acl import _ACLEntity BLOB_NAME = 'blob-name' permissive = [{'entity': 'allUsers', 'role': _ACLEntity.READER_ROLE}] diff --git a/gcloud/storage/test_bucket.py b/gcloud/storage/test_bucket.py index 03947b4db318..c01223375ce3 100644 --- a/gcloud/storage/test_bucket.py +++ b/gcloud/storage/test_bucket.py @@ -26,7 +26,7 @@ def _getTargetClass(self): def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) - def test_ctor_w_explicit_connection(self): + def test_ctor(self): connection = _Connection() client = _Client(connection) bucket = _Bucket() @@ -162,7 +162,7 @@ def api_request(cls, *args, **kwargs): expected_cw = [((), expected_called_kwargs)] self.assertEqual(_FakeConnection._called_with, expected_cw) - def test_create_hit_explicit_project(self): + def test_create_hit(self): BUCKET_NAME = 'bucket-name' DATA = {'name': BUCKET_NAME} connection = _Connection(DATA) @@ -238,7 +238,7 @@ def test_list_blobs_defaults(self): self.assertEqual(kw['path'], '/b/%s/o' % NAME) self.assertEqual(kw['query_params'], {'projection': 'noAcl'}) - def test_list_blobs_explicit(self): + def test_list_blobs_w_all_arguments(self): NAME = 'name' MAX_RESULTS = 10 PAGE_TOKEN = 'ABCD' @@ -276,7 +276,7 @@ def test_list_blobs_explicit(self): self.assertEqual(kw['path'], '/b/%s/o' % NAME) self.assertEqual(kw['query_params'], EXPECTED) - def test_list_blobs_w_explicit_connection(self): + def test_list_blobs(self): NAME = 'name' connection = _Connection({'items': []}) client = _Client(connection) @@ -289,7 +289,7 @@ def test_list_blobs_w_explicit_connection(self): self.assertEqual(kw['path'], '/b/%s/o' % NAME) self.assertEqual(kw['query_params'], {'projection': 'noAcl'}) - def test_delete_default_miss(self): + def test_delete_miss(self): from gcloud.exceptions import NotFound NAME = 'name' connection = _Connection() @@ -303,7 +303,7 @@ def test_delete_default_miss(self): }] self.assertEqual(connection._deleted_buckets, expected_cw) - def test_delete_explicit_hit(self): + def test_delete_hit(self): NAME = 'name' GET_BLOBS_RESP = {'items': []} connection = _Connection(GET_BLOBS_RESP) @@ -319,7 +319,7 @@ def test_delete_explicit_hit(self): }] self.assertEqual(connection._deleted_buckets, expected_cw) - def test_delete_explicit_force_delete_blobs(self): + def test_delete_force_delete_blobs(self): NAME = 'name' BLOB_NAME1 = 'blob-name1' BLOB_NAME2 = 'blob-name2' @@ -344,7 +344,7 @@ def test_delete_explicit_force_delete_blobs(self): }] self.assertEqual(connection._deleted_buckets, expected_cw) - def test_delete_explicit_force_miss_blobs(self): + def test_delete_force_miss_blobs(self): NAME = 'name' BLOB_NAME = 'blob-name1' GET_BLOBS_RESP = {'items': [{'name': BLOB_NAME}]} @@ -362,7 +362,7 @@ def test_delete_explicit_force_miss_blobs(self): }] self.assertEqual(connection._deleted_buckets, expected_cw) - def test_delete_explicit_too_many(self): + def test_delete_too_many(self): NAME = 'name' BLOB_NAME1 = 'blob-name1' BLOB_NAME2 = 'blob-name2' @@ -506,7 +506,7 @@ class _Blob(object): self.assertEqual(kw['method'], 'POST') self.assertEqual(kw['path'], COPY_PATH) - def test_upload_file_default_blob(self): + def test_upload_file_default_blob_name(self): from gcloud._testing import _Monkey from gcloud.storage import bucket as MUT BASENAME = 'file.ext' @@ -528,7 +528,7 @@ def upload_from_filename(self, filename, client=None): bucket.upload_file(FILENAME) self.assertEqual(_uploaded, [(bucket, BASENAME, FILENAME, None)]) - def test_upload_file_explicit_blob(self): + def test_upload_file_blob_w_blob_name(self): from gcloud._testing import _Monkey from gcloud.storage import bucket as MUT FILENAME = '/path/to/file' @@ -574,7 +574,7 @@ def upload_from_file(self, fh, client=None): self.assertEqual(found._name, FILENAME) self.assertTrue(found._bucket is bucket) - def test_upload_file_object_explicit_blob(self): + def test_upload_file_object_blob(self): from gcloud._testing import _Monkey from gcloud.storage import bucket as MUT FILENAME = 'file.txt' @@ -700,7 +700,7 @@ def test_enable_logging_defaults(self): self.assertEqual(info['logBucket'], LOG_BUCKET) self.assertEqual(info['logObjectPrefix'], '') - def test_enable_logging_explicit(self): + def test_enable_logging(self): NAME = 'name' LOG_BUCKET = 'logs' LOG_PFX = 'pfx' @@ -812,7 +812,7 @@ def test_configure_website_defaults(self): bucket.configure_website() self.assertEqual(bucket._properties, UNSET) - def test_configure_website_explicit(self): + def test_configure_website(self): NAME = 'name' WEBSITE_VAL = {'website': {'mainPageSuffix': 'html', 'notFoundPage': '404.html'}}