Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing outdated storage test names and test cases. #992

Merged
merged 1 commit into from
Jul 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gcloud/storage/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions gcloud/storage/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions gcloud/storage/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')()
Expand Down Expand Up @@ -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')()
Expand Down
18 changes: 9 additions & 9 deletions gcloud/storage/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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({})
Expand All @@ -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)
Expand All @@ -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}]})
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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})
Expand All @@ -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}
Expand All @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion gcloud/storage/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions gcloud/storage/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}]
Expand Down
28 changes: 14 additions & 14 deletions gcloud/storage/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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'
Expand All @@ -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}]}
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'}}
Expand Down