remove print statements and uncomment exceptions
This commit is contained in:
@@ -145,7 +145,6 @@ class HTTPClient(httplib2.Http):
|
|||||||
# Perform the request once. If we get a 401 back then it
|
# Perform the request once. If we get a 401 back then it
|
||||||
# might be because the auth token expired, so try to
|
# might be because the auth token expired, so try to
|
||||||
# re-authenticate and try again. If it still fails, bail.
|
# re-authenticate and try again. If it still fails, bail.
|
||||||
print 'SENDING: %s' % kwargs
|
|
||||||
try:
|
try:
|
||||||
resp, body = self.request(self.management_url + url, method,
|
resp, body = self.request(self.management_url + url, method,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
@@ -85,21 +85,20 @@ class Client(client.HTTPClient):
|
|||||||
Returns ``True`` if authentication was successful.
|
Returns ``True`` if authentication was successful.
|
||||||
"""
|
"""
|
||||||
self.management_url = self.auth_url
|
self.management_url = self.auth_url
|
||||||
# try:
|
try:
|
||||||
raw_token = self.tokens.authenticate(username=self.username,
|
raw_token = self.tokens.authenticate(username=self.username,
|
||||||
tenant_id=self.tenant_id,
|
tenant_id=self.tenant_id,
|
||||||
tenant_name=self.tenant_name,
|
tenant_name=self.tenant_name,
|
||||||
password=self.password,
|
password=self.password,
|
||||||
return_raw=True)
|
return_raw=True)
|
||||||
print 'got token %s' % raw_token
|
self._extract_service_catalog(self.auth_url, raw_token)
|
||||||
self._extract_service_catalog(self.auth_url, raw_token)
|
return True
|
||||||
return True
|
except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
|
||||||
# except (exceptions.AuthorizationFailure, exceptions.Unauthorized):
|
raise
|
||||||
# raise
|
except Exception, e:
|
||||||
# except Exception, e:
|
_logger.exception("Authorization Failed.")
|
||||||
# _logger.exception("Authorization Failed.")
|
raise exceptions.AuthorizationFailure("Authorization Failed: "
|
||||||
# raise exceptions.AuthorizationFailure("Authorization Failed: "
|
"%s" % e)
|
||||||
# "%s" % e)
|
|
||||||
|
|
||||||
def _extract_service_catalog(self, url, body):
|
def _extract_service_catalog(self, url, body):
|
||||||
""" Set the client's service catalog from the response data. """
|
""" Set the client's service catalog from the response data. """
|
||||||
|
@@ -144,7 +144,6 @@ class TenantTests(utils.TestCase):
|
|||||||
req_body['tenant']['name'],
|
req_body['tenant']['name'],
|
||||||
req_body['tenant']['description'],
|
req_body['tenant']['description'],
|
||||||
req_body['tenant']['enabled'])
|
req_body['tenant']['enabled'])
|
||||||
print tenant
|
|
||||||
self.assertTrue(isinstance(tenant, tenants.Tenant))
|
self.assertTrue(isinstance(tenant, tenants.Tenant))
|
||||||
self.assertEqual(tenant.id, 4)
|
self.assertEqual(tenant.id, 4)
|
||||||
self.assertEqual(tenant.name, "tenantX")
|
self.assertEqual(tenant.name, "tenantX")
|
||||||
|
Reference in New Issue
Block a user