Skip to content

Commit

Permalink
Don't assume that httplib2 responses contain any preset attributes, s…
Browse files Browse the repository at this point in the history
…ince they are looked up dynamically from a response headers dict. Fixes googleapis#93
  • Loading branch information
aliafshar committed May 19, 2014
1 parent 87c3e73 commit 4dd8f67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gcloud/storage/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, response, content):
class NotFoundError(ConnectionError):

def __init__(self, response, content):
self.message = 'GET %s returned a 404.' % (response.url)
self.message = 'Request returned a 404. Headers: %s' % (response)


class StorageDataError(StorageError):
Expand Down
11 changes: 10 additions & 1 deletion gcloud/storage/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import unittest2

from gcloud.storage.connection import Connection

from gcloud.storage.exceptions import NotFoundError

class TestConnection(unittest2.TestCase):

def test_init(self):
connection = Connection('project-name')
self.assertEqual('project-name', connection.project)


class TestExceptions(unittest2.TestCase):

def test_not_found_always_prints(self):
e = NotFoundError({}, None)
self.assertEqual('', str(e))


0 comments on commit 4dd8f67

Please sign in to comment.