Skip to content

Commit ea78a7a

Browse files
committed
Fixing outdated storage test names and test cases.
Also addressing a few docstrings that weren't changed during the transition to clients (from implicit).
1 parent 8a64306 commit ea78a7a

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

gcloud/storage/_helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _PropertyMixin(object):
2525
"""Abstract mixin for cloud storage classes with associated propertties.
2626
2727
Non-abstract subclasses should implement:
28-
- connection
28+
- client
2929
- path
3030
3131
:type name: string
@@ -65,8 +65,8 @@ def reload(self, client=None):
6565
"""Reload properties from Cloud Storage.
6666
6767
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
68-
:param client: Optional. The client to use. If not passed, falls back
69-
to default connection.
68+
:param client: the client to use. If not passed, falls back to the
69+
``client`` stored on the current object.
7070
"""
7171
client = self._require_client(client)
7272
# Pass only '?projection=noAcl' here because 'acl' and related
@@ -111,8 +111,8 @@ def patch(self, client=None):
111111
Updates the ``_properties`` with the response from the backend.
112112
113113
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
114-
:param client: Optional. The client to use. If not passed, falls back
115-
to default connection.
114+
:param client: the client to use. If not passed, falls back to the
115+
``client`` stored on the current object.
116116
"""
117117
client = self._require_client(client)
118118
# Pass '?projection=full' here because 'PATCH' documented not

gcloud/storage/acl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def _require_client(self, client):
359359
360360
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
361361
:param client: the client to use. If not passed, falls back to the
362-
``client`` stored on the current object.
362+
``client`` stored on the current ACL.
363363
364364
:rtype: :class:`gcloud.storage.client.Client`
365365
:returns: The client passed in or the currently bound client.
@@ -373,7 +373,7 @@ def reload(self, client=None):
373373
374374
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
375375
:param client: Optional. The client to use. If not passed, falls back
376-
to default connection.
376+
to the ``client`` stored on the ACL's parent.
377377
"""
378378
path = self.reload_path
379379
client = self._require_client(client)
@@ -394,7 +394,7 @@ def save(self, acl=None, client=None):
394394
395395
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
396396
:param client: Optional. The client to use. If not passed, falls back
397-
to default connection.
397+
to the ``client`` stored on the ACL's parent.
398398
"""
399399
if acl is None:
400400
acl = self
@@ -425,7 +425,7 @@ def clear(self, client=None):
425425
426426
:type client: :class:`gcloud.storage.client.Client` or ``NoneType``
427427
:param client: Optional. The client to use. If not passed, falls back
428-
to default connection.
428+
to the ``client`` stored on the ACL's parent.
429429
"""
430430
self.save([], client=client)
431431

gcloud/storage/test__helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_client_is_abstract(self):
4242
mixin = self._makeOne()
4343
self.assertRaises(NotImplementedError, lambda: mixin.client)
4444

45-
def test_reload_w_explicit_connection(self):
45+
def test_reload(self):
4646
connection = _Connection({'foo': 'Foo'})
4747
client = _Client(connection)
4848
derived = self._derivedClass('/path')()
@@ -70,7 +70,7 @@ def test__patch_property(self):
7070
derived._patch_property('foo', 'Foo')
7171
self.assertEqual(derived._properties, {'foo': 'Foo'})
7272

73-
def test_patch_w_explicit_connection(self):
73+
def test_patch(self):
7474
connection = _Connection({'foo': 'Foo'})
7575
client = _Client(connection)
7676
derived = self._derivedClass('/path')()

gcloud/storage/test_acl.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_ctor_default_identifier(self):
3131
self.assertEqual(entity.identifier, None)
3232
self.assertEqual(entity.get_roles(), set())
3333

34-
def test_ctor_explicit_identifier(self):
34+
def test_ctor_w_identifier(self):
3535
TYPE = 'type'
3636
ID = 'id'
3737
entity = self._makeOne(TYPE, ID)
@@ -509,7 +509,7 @@ def test_get_entities_nonempty(self):
509509
entity = acl.entity(TYPE, ID)
510510
self.assertEqual(acl.get_entities(), [entity])
511511

512-
def test_reload_missing_w_explicit_connection(self):
512+
def test_reload_missing(self):
513513
# https://github.com/GoogleCloudPlatform/gcloud-python/issues/652
514514
ROLE = 'role'
515515
connection = _Connection({})
@@ -525,7 +525,7 @@ def test_reload_missing_w_explicit_connection(self):
525525
self.assertEqual(kw[0]['method'], 'GET')
526526
self.assertEqual(kw[0]['path'], '/testing/acl')
527527

528-
def test_reload_empty_result_clears_local_w_explicit_connection(self):
528+
def test_reload_empty_result_clears_local(self):
529529
ROLE = 'role'
530530
connection = _Connection({'items': []})
531531
client = _Client(connection)
@@ -541,7 +541,7 @@ def test_reload_empty_result_clears_local_w_explicit_connection(self):
541541
self.assertEqual(kw[0]['method'], 'GET')
542542
self.assertEqual(kw[0]['path'], '/testing/acl')
543543

544-
def test_reload_nonempty_result_w_explicit_connection(self):
544+
def test_reload_nonempty_result(self):
545545
ROLE = 'role'
546546
connection = _Connection(
547547
{'items': [{'entity': 'allUsers', 'role': ROLE}]})
@@ -557,7 +557,7 @@ def test_reload_nonempty_result_w_explicit_connection(self):
557557
self.assertEqual(kw[0]['method'], 'GET')
558558
self.assertEqual(kw[0]['path'], '/testing/acl')
559559

560-
def test_save_none_set_none_passed_w_explicit_connection(self):
560+
def test_save_none_set_none_passed(self):
561561
connection = _Connection()
562562
client = _Client(connection)
563563
acl = self._makeOne()
@@ -566,7 +566,7 @@ def test_save_none_set_none_passed_w_explicit_connection(self):
566566
kw = connection._requested
567567
self.assertEqual(len(kw), 0)
568568

569-
def test_save_existing_missing_none_passed_w_explicit_connection(self):
569+
def test_save_existing_missing_none_passed(self):
570570
connection = _Connection({})
571571
client = _Client(connection)
572572
acl = self._makeOne()
@@ -581,7 +581,7 @@ def test_save_existing_missing_none_passed_w_explicit_connection(self):
581581
self.assertEqual(kw[0]['data'], {'acl': []})
582582
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
583583

584-
def test_save_no_arg_w_explicit_connection(self):
584+
def test_save_no_arg(self):
585585
ROLE = 'role'
586586
AFTER = [{'entity': 'allUsers', 'role': ROLE}]
587587
connection = _Connection({'acl': AFTER})
@@ -599,7 +599,7 @@ def test_save_no_arg_w_explicit_connection(self):
599599
self.assertEqual(kw[0]['data'], {'acl': AFTER})
600600
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
601601

602-
def test_save_w_arg_w_explicit_connection(self):
602+
def test_save_w_arg(self):
603603
ROLE1 = 'role1'
604604
ROLE2 = 'role2'
605605
STICKY = {'entity': 'allUsers', 'role': ROLE2}
@@ -621,7 +621,7 @@ def test_save_w_arg_w_explicit_connection(self):
621621
self.assertEqual(kw[0]['data'], {'acl': new_acl})
622622
self.assertEqual(kw[0]['query_params'], {'projection': 'full'})
623623

624-
def test_clear_w_explicit_connection(self):
624+
def test_clear(self):
625625
ROLE1 = 'role1'
626626
ROLE2 = 'role2'
627627
STICKY = {'entity': 'allUsers', 'role': ROLE2}

gcloud/storage/test_batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _getTargetClass(self):
7575
def _makeOne(self, *args, **kw):
7676
return self._getTargetClass()(*args, **kw)
7777

78-
def test_ctor_w_explicit_connection(self):
78+
def test_ctor(self):
7979
http = _HTTP()
8080
connection = _Connection(http=http)
8181
client = _Client(connection)

gcloud/storage/test_blob.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_generate_signed_url_w_slash_in_name(self):
183183
}
184184
self.assertEqual(SIGNER._signed, [(EXPECTED_ARGS, EXPECTED_KWARGS)])
185185

186-
def test_generate_signed_url_w_explicit_method(self):
186+
def test_generate_signed_url_w_method_arg(self):
187187
from gcloud._testing import _Monkey
188188
from gcloud.storage import blob as MUT
189189

@@ -674,7 +674,7 @@ def test_upload_from_string_w_text(self):
674674
self.assertEqual(headers['Content-Type'], 'text/plain')
675675
self.assertEqual(rq[0]['body'], ENCODED)
676676

677-
def test_make_public_w_explicit_connection(self):
677+
def test_make_public(self):
678678
from gcloud.storage.acl import _ACLEntity
679679
BLOB_NAME = 'blob-name'
680680
permissive = [{'entity': 'allUsers', 'role': _ACLEntity.READER_ROLE}]

gcloud/storage/test_bucket.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _getTargetClass(self):
2626
def _makeOne(self, *args, **kw):
2727
return self._getTargetClass()(*args, **kw)
2828

29-
def test_ctor_w_explicit_connection(self):
29+
def test_ctor(self):
3030
connection = _Connection()
3131
client = _Client(connection)
3232
bucket = _Bucket()
@@ -162,7 +162,7 @@ def api_request(cls, *args, **kwargs):
162162
expected_cw = [((), expected_called_kwargs)]
163163
self.assertEqual(_FakeConnection._called_with, expected_cw)
164164

165-
def test_create_hit_explicit_project(self):
165+
def test_create_hit(self):
166166
BUCKET_NAME = 'bucket-name'
167167
DATA = {'name': BUCKET_NAME}
168168
connection = _Connection(DATA)
@@ -238,7 +238,7 @@ def test_list_blobs_defaults(self):
238238
self.assertEqual(kw['path'], '/b/%s/o' % NAME)
239239
self.assertEqual(kw['query_params'], {'projection': 'noAcl'})
240240

241-
def test_list_blobs_explicit(self):
241+
def test_list_blobs_w_all_arguments(self):
242242
NAME = 'name'
243243
MAX_RESULTS = 10
244244
PAGE_TOKEN = 'ABCD'
@@ -276,7 +276,7 @@ def test_list_blobs_explicit(self):
276276
self.assertEqual(kw['path'], '/b/%s/o' % NAME)
277277
self.assertEqual(kw['query_params'], EXPECTED)
278278

279-
def test_list_blobs_w_explicit_connection(self):
279+
def test_list_blobs(self):
280280
NAME = 'name'
281281
connection = _Connection({'items': []})
282282
client = _Client(connection)
@@ -289,7 +289,7 @@ def test_list_blobs_w_explicit_connection(self):
289289
self.assertEqual(kw['path'], '/b/%s/o' % NAME)
290290
self.assertEqual(kw['query_params'], {'projection': 'noAcl'})
291291

292-
def test_delete_default_miss(self):
292+
def test_delete_miss(self):
293293
from gcloud.exceptions import NotFound
294294
NAME = 'name'
295295
connection = _Connection()
@@ -303,7 +303,7 @@ def test_delete_default_miss(self):
303303
}]
304304
self.assertEqual(connection._deleted_buckets, expected_cw)
305305

306-
def test_delete_explicit_hit(self):
306+
def test_delete_hit(self):
307307
NAME = 'name'
308308
GET_BLOBS_RESP = {'items': []}
309309
connection = _Connection(GET_BLOBS_RESP)
@@ -319,7 +319,7 @@ def test_delete_explicit_hit(self):
319319
}]
320320
self.assertEqual(connection._deleted_buckets, expected_cw)
321321

322-
def test_delete_explicit_force_delete_blobs(self):
322+
def test_delete_force_delete_blobs(self):
323323
NAME = 'name'
324324
BLOB_NAME1 = 'blob-name1'
325325
BLOB_NAME2 = 'blob-name2'
@@ -344,7 +344,7 @@ def test_delete_explicit_force_delete_blobs(self):
344344
}]
345345
self.assertEqual(connection._deleted_buckets, expected_cw)
346346

347-
def test_delete_explicit_force_miss_blobs(self):
347+
def test_delete_force_miss_blobs(self):
348348
NAME = 'name'
349349
BLOB_NAME = 'blob-name1'
350350
GET_BLOBS_RESP = {'items': [{'name': BLOB_NAME}]}
@@ -362,7 +362,7 @@ def test_delete_explicit_force_miss_blobs(self):
362362
}]
363363
self.assertEqual(connection._deleted_buckets, expected_cw)
364364

365-
def test_delete_explicit_too_many(self):
365+
def test_delete_too_many(self):
366366
NAME = 'name'
367367
BLOB_NAME1 = 'blob-name1'
368368
BLOB_NAME2 = 'blob-name2'
@@ -506,7 +506,7 @@ class _Blob(object):
506506
self.assertEqual(kw['method'], 'POST')
507507
self.assertEqual(kw['path'], COPY_PATH)
508508

509-
def test_upload_file_default_blob(self):
509+
def test_upload_file_default_blob_name(self):
510510
from gcloud._testing import _Monkey
511511
from gcloud.storage import bucket as MUT
512512
BASENAME = 'file.ext'
@@ -528,7 +528,7 @@ def upload_from_filename(self, filename, client=None):
528528
bucket.upload_file(FILENAME)
529529
self.assertEqual(_uploaded, [(bucket, BASENAME, FILENAME, None)])
530530

531-
def test_upload_file_explicit_blob(self):
531+
def test_upload_file_blob_w_blob_name(self):
532532
from gcloud._testing import _Monkey
533533
from gcloud.storage import bucket as MUT
534534
FILENAME = '/path/to/file'
@@ -574,7 +574,7 @@ def upload_from_file(self, fh, client=None):
574574
self.assertEqual(found._name, FILENAME)
575575
self.assertTrue(found._bucket is bucket)
576576

577-
def test_upload_file_object_explicit_blob(self):
577+
def test_upload_file_object_blob(self):
578578
from gcloud._testing import _Monkey
579579
from gcloud.storage import bucket as MUT
580580
FILENAME = 'file.txt'
@@ -700,7 +700,7 @@ def test_enable_logging_defaults(self):
700700
self.assertEqual(info['logBucket'], LOG_BUCKET)
701701
self.assertEqual(info['logObjectPrefix'], '')
702702

703-
def test_enable_logging_explicit(self):
703+
def test_enable_logging(self):
704704
NAME = 'name'
705705
LOG_BUCKET = 'logs'
706706
LOG_PFX = 'pfx'
@@ -812,7 +812,7 @@ def test_configure_website_defaults(self):
812812
bucket.configure_website()
813813
self.assertEqual(bucket._properties, UNSET)
814814

815-
def test_configure_website_explicit(self):
815+
def test_configure_website(self):
816816
NAME = 'name'
817817
WEBSITE_VAL = {'website': {'mainPageSuffix': 'html',
818818
'notFoundPage': '404.html'}}

0 commit comments

Comments
 (0)