Skip to content

Commit

Permalink
Unneeded shim.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Nov 11, 2014
1 parent a1903ae commit 47b23fb
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions gcloud/storage/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,23 +620,23 @@ def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw)

def test_ctor(self):
connection = _Connection()
connection = object()
iterator = self._makeOne(connection)
self.assertTrue(iterator.connection is connection)
self.assertEqual(iterator.path, '/b')
self.assertEqual(iterator.page_number, 0)
self.assertEqual(iterator.next_page_token, None)

def test_get_items_from_response_empty(self):
connection = _Connection()
connection = object()
iterator = self._makeOne(connection)
self.assertEqual(list(iterator.get_items_from_response({})), [])

def test_get_items_from_response_non_empty(self):
from gcloud.storage.bucket import Bucket
KEY = 'key'
response = {'items': [{'name': KEY}]}
connection = _Connection()
connection = object()
iterator = self._makeOne(connection)
buckets = list(iterator.get_items_from_response(response))
self.assertEqual(len(buckets), 1)
Expand Down Expand Up @@ -741,24 +741,6 @@ def request(self, **kw):
return self._response, self._content


class _Connection(object):

def __init__(self, *responses):
self._responses = responses
self._requested = []

def api_request(self, **kw):
from gcloud.storage.exceptions import NotFound
self._requested.append(kw)

try:
response, self._responses = self._responses[0], self._responses[1:]
except:
raise NotFound('miss')
else:
return response


class _Credentials(object):

service_account_name = 'testing@example.com'
Expand Down

0 comments on commit 47b23fb

Please sign in to comment.