remove print statements and uncomment exceptions

This commit is contained in:
Jesse Andrews
2011-12-17 22:48:37 -08:00
parent a8001d3e6c
commit 55c01652b2
3 changed files with 14 additions and 17 deletions

View File

@@ -145,7 +145,6 @@ class HTTPClient(httplib2.Http):
# Perform the request once. If we get a 401 back then it
# might be because the auth token expired, so try to
# re-authenticate and try again. If it still fails, bail.
print 'SENDING: %s' % kwargs
try:
resp, body = self.request(self.management_url + url, method,
**kwargs)

View File

@@ -85,21 +85,20 @@ class Client(client.HTTPClient):
Returns ``True`` if authentication was successful.
"""
self.management_url = self.auth_url
# try:
raw_token = self.tokens.authenticate(username=self.username,
tenant_id=self.tenant_id,
tenant_name=self.tenant_name,
password=self.password,
return_raw=True)
print 'got token %s' % raw_token
self._extract_service_catalog(self.auth_url, raw_token)
return True
# except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
# raise
# except Exception, e:
# _logger.exception("Authorization Failed.")
# raise exceptions.AuthorizationFailure("Authorization Failed: "
# "%s" % e)
try:
raw_token = self.tokens.authenticate(username=self.username,
tenant_id=self.tenant_id,
tenant_name=self.tenant_name,
password=self.password,
return_raw=True)
self._extract_service_catalog(self.auth_url, raw_token)
return True
except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
raise
except Exception, e:
_logger.exception("Authorization Failed.")
raise exceptions.AuthorizationFailure("Authorization Failed: "
"%s" % e)
def _extract_service_catalog(self, url, body):
""" Set the client's service catalog from the response data. """

View File

@@ -144,7 +144,6 @@ class TenantTests(utils.TestCase):
req_body['tenant']['name'],
req_body['tenant']['description'],
req_body['tenant']['enabled'])
print tenant
self.assertTrue(isinstance(tenant, tenants.Tenant))
self.assertEqual(tenant.id, 4)
self.assertEqual(tenant.name, "tenantX")